Redux Dynamic Manager
Modularize Redux by dynamically loading reducers.
Installation and Usage
$ npm i redux-dynamic-manager -S# or $ yarn add redux-dynamic-manager
// for commonjsconst createReducerManager bindReducerManager dynamic = ; // for es modules;
Getting Started
Configure Store
;;;; ; ; const rootReducer = app: appReducer router: ; const reducerManager = ; ; const configureStore = { const composeEnhancer = window__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose; const store = ; return store;};
Load Component
; const HelloWorld = React;
;;;; ; const Title = ` color: #222222;`; const HelloWorld = { const world = ; const hello = ; return <div id="hello-world"> <Title>hello world!</Title> </div> ;}; 'helloWorld' reducerHelloWorld; // before:// {// "app": ...,// "router": ...// } // after:// {// "app": ...,// "router": ...,// "helloWorld": ...// }
Nested modules:
;;;; ; const Title = ` color: #222222;`; const HelloWorld = { const world = ; const hello = ; return <div id="hello-world"> <Title>hello world!</Title> </div> ;}; 'hello' 'world' reducerHelloWorld; // before:// {// "app": ...,// "router": ...// } // after:// {// "app": ...,// "router": ...,// "hello": {// "world": ...// }// }