Redux Thunk
Thunk middleware that lets Redux action creators return functions instead of plain objects
Repository Health
Technical Analysis
Redux Thunk is the canonical middleware for writing asynchronous and conditional logic in Redux applications. Instead of dispatching only plain action objects, it lets action creators return a function (a “thunk”) that receives dispatch, getState, and an optional injected extra argument, enabling API calls, delayed dispatches, and conditional dispatch logic to live alongside the rest of an app’s Redux code.
Maintained by the Redux core team, it ships as a single small middleware factory with full TypeScript support and is included by default in Redux Toolkit’s configureStore. Its minimal surface area — one function, one composition pattern — has made it the default recommendation for basic async side effects in Redux, with more complex flows typically graduating to Redux Saga or RTK Query only when needed.
What You Get
- A
thunkmiddleware export that intercepts function-type dispatches and invokes them withdispatch,getState, and an extra argument - A
withExtraArgument()factory for injecting a custom dependency (e.g. an API client) into every thunk - Full TypeScript types for
ThunkAction,ThunkDispatch, andThunkMiddlewaregenerics - Zero runtime dependencies beyond Redux itself
- Automatic inclusion in Redux Toolkit’s
configureStoredefault middleware
Common Use Cases
- Dispatching an async action creator that performs an API call and dispatches success/failure actions
- Conditionally dispatching an action only if certain state conditions are met
- Injecting a mockable API service as an extra argument for easier testing of async logic
- Composing multiple async action creators together via returned Promises for sequential control flow
Under The Hood
Architecture - The entire library is a single higher-order function (createThunkMiddleware) in src/index.ts that returns standard Redux middleware: it checks whether the dispatched action is a function, and if so calls it with (dispatch, getState, extraArgument) instead of forwarding it down the middleware chain, otherwise passing plain actions through untouched. Tech Stack - Written in TypeScript, built to dual CJS/ESM output (dist/cjs, dist/redux-thunk.mjs) via a Rollup-based build, with redux as the only peer dependency and no runtime dependencies of its own. Code Quality - Tests run via Vitest with --typecheck enabled so type-level behavior is verified alongside runtime behavior, plus ESLint and Prettier enforced through lint/format:check scripts gating prepublishOnly. API Design - The API is deliberately minimal — one named export (thunk) for the common case and one factory (withExtraArgument) for the customized case — which keeps the learning curve very low and the composition pattern (return a function, get dispatch/getState) trivial to teach.
Used by 19 apps in this directory
Kibana
Analytics · Monitoring
Your open source window into the Elastic Stack — query, visualize, and act on data stored in Elasticsearch with real-time dashboards, AI-assisted search, and automated alerting.
Laudspeaker
Automation · Marketing
Open-source customer engagement platform for building visual, event-triggered messaging journeys across email, SMS, push, in-app, and webhooks.
Mattermost
Collaboration · Devops · Team Chat
Open core, self-hosted team collaboration with chat, AI agents, voice calling, and deep DevOps integrations — all under your control.
MLflow
AI Development · Monitoring
The open source AI engineering platform for debugging, evaluating, monitoring, and optimizing production LLMs and agents at scale.
opencloud
File Storage
Open source file management and collaboration platform that keeps your data under your control, no database required.
QRev
AI Agents · CRM
Open source AI-first sales platform that replaces Salesforce with autonomous agents handling prospecting, outreach, and lead management at scale.
Responsively App
Design Tools · Developer Tools
Preview and interact with your responsive web design across every device size simultaneously — no more manual resizing.
SigNoz
Analytics · Monitoring
Self-host your entire observability stack — logs, metrics, traces, and LLM monitoring — in one OpenTelemetry-native platform, without the Datadog bill.
Twake Drive
Collaboration · File Storage
Open-source, self-hosted file manager with collaborative drives, AI-powered summarization, and OnlyOffice document editing for teams who want full data sovereignty.