{"id":17906,"library":"redux-middleware","title":"Redux Common Middleware Collection","description":"redux-middleware is an abandoned JavaScript library (current version 0.1.21, last updated over 7 years ago) that provides a collection of common Redux middleware functions. These middlewares address various concerns such as `metaRouter` for handling meta-actions (delay, identity, API, routing, idle, error), `thunk` for asynchronous actions, `readyStatePromise` for promise-based state updates, `logger` for debugging, and `crashReporter` for error handling. The library was explicitly noted in its README as being in early development and not ready for production use, with a warning that it would be changing rapidly. Given its lack of updates since then, it is effectively abandoned. While it aimed to offer a convenient set of utilities for common Redux patterns, its early and unmaintained state makes it unsuitable for modern applications. Key differentiators at the time of its development included a structured approach to meta-action handling and pre-packaged common utilities.","status":"abandoned","version":"0.1.21","language":"javascript","source_language":"en","source_url":"https://github.com/cchamberlain/redux-middleware","tags":["javascript","redux","middleware","delay","schedule","api","route","idle","error"],"install":[{"cmd":"npm install redux-middleware","lang":"bash","label":"npm"},{"cmd":"yarn add redux-middleware","lang":"bash","label":"yarn"},{"cmd":"pnpm add redux-middleware","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core dependency for creating and applying Redux middleware.","package":"redux","optional":false}],"imports":[{"note":"For ES6+ environments. For CommonJS, use the `require` syntax targeting `redux-middleware/lib`.","wrong":"const { applyLogicalMiddleware } = require('redux-middleware')","symbol":"applyLogicalMiddleware","correct":"import { applyLogicalMiddleware } from 'redux-middleware'"},{"note":"Individual middlewares are typically default exports from their respective paths. Use `/lib` for ES5/CommonJS, or `/src/lib` for ES6+ source code.","wrong":"import { metaRouter } from 'redux-middleware/lib/metaRouter'","symbol":"metaRouter","correct":"import metaRouter from 'redux-middleware/lib/metaRouter'"},{"note":"This is a named export from the `metaRouter` module. Pathing depends on your ES version as noted above.","wrong":"const createMetaRouter = require('redux-middleware/lib/metaRouter').default","symbol":"createMetaRouter","correct":"import { createMetaRouter } from 'redux-middleware/lib/metaRouter'"}],"quickstart":{"code":"import { createStore, applyMiddleware, combineReducers } from 'redux';\nimport { applyLogicalMiddleware } from 'redux-middleware';\n\n// Basic Reducer (for demonstration)\nconst exampleReducer = (state = { count: 0 }, action) => {\n  switch (action.type) {\n    case 'INCREMENT':\n      return { ...state, count: state.count + 1 };\n    case 'DECREMENT':\n      return { ...state, count: state.count - 1 };\n    default:\n      return state;\n  }\n};\n\nconst rootReducer = combineReducers({\n  example: exampleReducer,\n});\n\n// Create a store creator that applies the logical middleware\nconst createStoreWithLogicalMiddleware = applyLogicalMiddleware()(createStore);\n\n// Configure the store\nexport function configureStore(initialState = {}) {\n  return createStoreWithLogicalMiddleware(rootReducer, initialState);\n}\n\n// Example usage:\nconst store = configureStore();\nconsole.log('Initial state:', store.getState());\n\nstore.dispatch({ type: 'INCREMENT' });\nconsole.log('State after INCREMENT:', store.getState());\n\n// You would typically use individual middlewares directly via applyMiddleware, e.g.:\n// import thunk from 'redux-middleware/lib/thunk';\n// const storeWithThunk = createStore(rootReducer, applyMiddleware(thunk));\n","lang":"javascript","description":"This quickstart demonstrates how to configure a Redux store using `applyLogicalMiddleware` from `redux-middleware` to inject its bundled middleware. It shows basic Redux setup with a dummy reducer and store creation."},"warnings":[{"fix":"Migrate to actively maintained Redux middleware alternatives (e.g., `redux-thunk`, `redux-logger`, `redux-saga`, `redux-observable`) or implement custom middleware.","message":"This library is explicitly marked as 'in early development' and 'not ready for production use' in its README. It has not been updated in over 7 years (since version 0.1.21 was published). It is considered abandoned and should not be used in any active projects.","severity":"breaking","affected_versions":">=0.1.0"},{"fix":"Ensure you are importing from `redux-middleware/lib` for CommonJS/ES5 environments, and potentially `redux-middleware/src/lib` if your build system explicitly processes source files and you intend to use ES6+ features directly from source. For most modern setups, `redux-middleware/lib` will be the correct target.","message":"The library differentiates between ES5 and ES6+ module paths (`redux-middleware/lib` vs `redux-middleware/src/lib`). Using the incorrect path for your build setup will lead to module resolution errors or incorrect code execution.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"If using `metaRouter`, thoroughly test its behavior for your specific use cases. Given the library's abandoned status, issues in `metaRouter` will likely require manual fixes or reimplementation.","message":"The `metaRouter` middleware, a core component for handling meta-actions, is noted in the README as 'Needs work'. This indicates potential instability, incomplete features, or known bugs within that specific middleware.","severity":"gotcha","affected_versions":">=0.1.0"}],"env_vars":null,"last_verified":"2026-04-23T00:00:00.000Z","next_check":"2026-07-22T00:00:00.000Z","problems":[{"fix":"Ensure actions processed by `createMetaRouter` include a `meta` field, or that `createMetaRouter` is configured to handle actions without `meta` gracefully (though the default implementation directly returns `next(action)`).","cause":"The `createMetaRouter` middleware expects actions with a `meta` property, but an action without `meta` was dispatched and not properly handled by upstream middleware or the `metaRouter` configuration.","error":"TypeError: Cannot read properties of undefined (reading 'meta') (or similar for 'meta')"},{"fix":"When importing individual middlewares, ensure you are importing the default export (e.g., `import thunk from 'redux-middleware/lib/thunk'`) and that it is a function that returns the actual middleware. If `applyLogicalMiddleware` is used, ensure it is called as a function (e.g., `applyLogicalMiddleware()(createStore)`).","cause":"This error often occurs when an individual middleware (e.g., `metaRouter`, `thunk`) is imported incorrectly, or if you try to pass the raw module to `applyMiddleware` instead of its default function export.","error":"Error: Middleware is not a function"},{"fix":"Change your import paths from `/src/lib` to `/lib` (e.g., `import metaRouter from 'redux-middleware/lib/metaRouter'`). The `/lib` directory typically contains the transpiled ES5 version suitable for most environments.","cause":"Your build system (e.g., Webpack, Rollup) cannot find the module at the specified path. This often happens when you're trying to import from `/src/lib` in a production build or in an environment that doesn't transpile source files directly from `node_modules`.","error":"Module not found: Can't resolve 'redux-middleware/src/lib/metaRouter'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}