{"id":26174,"library":"redux-injector","title":"redux-injector","description":"A library for dynamically injecting reducers into a Redux store at runtime, enabling lazy loading of reducers and plugin architectures. Version 0.1.0 is the only stable release. Unlike static combineReducers, it uses createInjectStore to accept an uncombined reducer tree and injectReducer to add reducers by path (e.g., 'date.form'). Relies on lodash.set. Release cadence is unknown; last update was years ago. Alternative to static reducer composition or other dynamic Redux solutions like Redux Toolkit's reducer injection examples. Minimal documentation and no recent maintenance, so consider compatibility with modern Redux carefully.","status":"maintenance","version":"0.1.0","language":"javascript","source_language":"en","source_url":"https://github.com/randallknutson/redux-injector","tags":["javascript","redux","react"],"install":[{"cmd":"npm install redux-injector","lang":"bash","label":"npm"},{"cmd":"yarn add redux-injector","lang":"bash","label":"yarn"},{"cmd":"pnpm add redux-injector","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency: wraps createStore and uses combineReducers.","package":"redux","optional":true},{"reason":"Used for lodash.set to set reducer paths.","package":"lodash","optional":false}],"imports":[{"note":"This is a named export, not a default export.","wrong":"import createInjectStore from 'redux-injector'","symbol":"createInjectStore","correct":"import { createInjectStore } from 'redux-injector'"},{"note":"CommonJS requires valueless, but ESM named import is preferred.","wrong":"const injectReducer = require('redux-injector').injectReducer","symbol":"injectReducer","correct":"import { injectReducer } from 'redux-injector'"},{"note":"No default export exists; using named exports only.","wrong":"import reduxInjector from 'redux-injector'","symbol":"default import (nonexistent)","correct":"import { createInjectStore, injectReducer } from 'redux-injector'"}],"quickstart":{"code":"import { createStore, combineReducers } from 'redux';\nimport { createInjectStore, injectReducer } from 'redux-injector';\n\n// Reducer tree (uncombined)\nconst reducersObject = {\n  counter: (state = 0, action) => {\n    switch (action.type) {\n      case 'INCREMENT': return state + 1;\n      default: return state;\n    }\n  }\n};\n\n// Create store with inject capability\nconst store = createInjectStore(reducersObject, {});\n\n// Later, inject a new reducer\ninjectReducer('todos', (state = [], action) => {\n  switch (action.type) {\n    case 'ADD_TODO': return [...state, action.payload];\n    default: return state;\n  }\n});\n\nstore.dispatch({ type: 'INCREMENT' });\nstore.dispatch({ type: 'ADD_TODO', payload: 'Learn redux-injector' });\nconsole.log(store.getState());\n// Output: { counter: 1, todos: ['Learn redux-injector'] }","lang":"javascript","description":"Demonstrates creating a store with createInjectStore and dynamically injecting a reducer using injectReducer with a dot path."},"warnings":[{"fix":"Be careful with path strings; they follow lodash.set conventions.","message":"injectReducer uses lodash.set so you must ensure path supports dot notation; missing intermediate objects are created automatically.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Pass an object of reducer functions without combineReducers.","message":"Do NOT combine reducers with combineReducers before passing to createInjectStore; pass the plain object tree instead.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Consider alternatives like Redux Toolkit's dynamic reducer injection or useReducer-based solutions.","message":"Package has not been updated in years; may be incompatible with latest Redux and React versions.","severity":"deprecated","affected_versions":">=0.1.0"},{"fix":"Inject before any complex state changes or use immutable injection patterns.","message":"injectReducer mutates the store's reducer map and may cause subtle bugs if injected after reducers have been combined.","severity":"gotcha","affected_versions":">=0.1.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Pass the uncombined reducer object tree, not the result of combineReducers.","cause":"You passed a combined reducer (result of combineReducers) to createInjectStore instead of a plain object tree.","error":"Uncaught Error: Reducer \"...\" returned undefined during initialization."},{"fix":"Install lodash: npm install lodash","cause":"Missing lodash dependency (lodash.set not available).","error":"TypeError: Cannot read property 'set' of undefined"},{"fix":"Use createInjectStore from redux-injector instead of createStore.","cause":"Trying to use injectReducer on a store created with regular createStore, not createInjectStore.","error":"TypeError: state is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}