MCPcopy Create free account
hub / github.com/krasimir/react-in-patterns / replaceReducer

Function replaceReducer

code/redux/public/app.js:21611–21618  ·  view source on GitHub ↗

* Replaces the reducer currently used by the store to calculate the state. * * You might need this if your app implements code splitting and you want to * load some of the reducers dynamically. You might also need this if you * implement a hot reloading mechanism for Redux. * * @pa

(nextReducer)

Source from the content-addressed store, hash-verified

21609 * @returns {void}
21610 */
21611 function replaceReducer(nextReducer) {
21612 if (typeof nextReducer !== 'function') {
21613 throw new Error('Expected the nextReducer to be a function.');
21614 }
21615
21616 currentReducer = nextReducer;
21617 dispatch({ type: ActionTypes.INIT });
21618 }
21619
21620 /**
21621 * Interoperability point for observable/reactive libraries.

Callers

nothing calls this directly

Calls 1

dispatchFunction · 0.70

Tested by

no test coverage detected