{"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.","language":"javascript","status":"abandoned","last_verified":"Thu Apr 23","install":{"commands":["npm install redux-middleware"],"cli":null},"imports":["import { applyLogicalMiddleware } from 'redux-middleware'","import metaRouter from 'redux-middleware/lib/metaRouter'","import { createMetaRouter } from 'redux-middleware/lib/metaRouter'"],"auth":{"required":false,"env_vars":[]},"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.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}