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
APITable
Low Code Platforms · Databases
API-first collaborative spreadsheet-database platform that auto-generates REST APIs and lets teams build internal tools, CRMs, and dashboards without code.
Bigcapital
Invoicing Finance
Self-hostable double-entry accounting platform with invoicing, inventory, multi-currency, and real-time financial reporting for small and medium businesses.
ChartBrew
Analytics · Databases
Open-source reporting platform to build live dashboards from SQL, NoSQL, APIs, and SaaS tools with an AI assistant that creates charts from natural language.
Chaskiq
CRM · Customer Support
Self-hosted live chat, video calls, help center, and marketing automation — a full-stack Intercom alternative you run on your own infrastructure.
ClearFlask
Product Management · Community
Open-source feedback management and roadmap tool that lets product teams collect, prioritize, and respond to user input — with AI-powered summarization and full self-hosting control.
Continue
Developer Tools · AI Development · AI Code Assistants
Open-source coding agent for VS Code, JetBrains, and CLI with support for 30+ LLM providers.
GB Studio
Developer Tools · Game Development · Design Tools
Drag-and-drop retro Game Boy game creator that compiles real ROMs — no coding required.
Grafana
Monitoring · Analytics
The open-source observability platform that unifies metrics, logs, and traces from any data source into dynamic, queryable dashboards.
Jitsi Meet
Team Chat · Collaboration · Video Conferencing
Open-source, end-to-end encrypted video conferencing you can self-host or embed into any web or mobile app.