redux-immutable-merge-reducers
Return the flattened output of the redux-immutable combineReducers function.
Description
Use redux-immutable-merge-reducers
when you want to combine reducers into one flattened state object.
Import mergeReducers
as so:
;
Then pass any number of reducers you'd like to mergeReducers
like so:
;
Your store should then contain a flattened object with the state of both reducers, similar to the result you would get from using the spread operator
to combine objects in es6:
{ ...stateA, ...stateB };
Example
Given the following reducers:
;; const reducerAInitialState = ; { } ;
;; const reducerBInitialState = ; { } ;
And the following reducer:
myReducer: ;
Your store would contain the following state tree:
myReducer: {
someStateObject: {
aNestedStateObject: {
aDeeplyNestedList: []
}
},
someOtherStateObject: {
anotherNestedStateObject: {
anotherDeeplyNestedList: []
}
},
moreStateThisTimeAString: "An example string."
};
Installation
npm i --save redux-immutable-merge-reducers
yarn add redux-immutable-merge-reducers
License
MIT