Library to dynamically inject reducers into a Redux store at runtime, supporting Hot Module Replacement (HMR) and Server-Side Rendering (SSR). Version 0.3.5 is the latest stable release. It wraps Redux's createStore to accept an uncombined reducer tree and allows adding reducers via injectReducer at any path. Key differentiators include support for nested reducer injection without combineReducers, forced reinjection, bulk injection, and explicit reloadReducer for HMR. Maintained by GuillaumeCisco and based on the work of redux-injector. The package has a small footprint but lacks TypeScript types and relies on lodash.set.
npm install redux-reducers-injectorNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates how to create a Redux store with redux-reducers-injector using an uncombined reducer object and inject a new reducer dynamically.
Pass an object tree of reducer functions (without combineReducers) to createInjectStore.
Use string paths like 'data.form' to indicate nesting. For literal dots in keys, escape or avoid dot notation.
In v0.3.0+, use the optional store parameter in injectReducer to specify a context store. For older versions, avoid SSR or implement per-request store management manually.
Add declare module 'redux-reducers-injector' { ... } or use a type assertion.Pass an object of reducer functions without combining them first.
Ensure createInjectStore is called and the store is fully initialized before calling injectReducer. For SSR, pass the store as the context parameter.
Use createInjectStore (from this package) to create the store, not createStore from redux.