Redux always use root reducer function that accept the current state and action as input and it return a new state. in many cases you want to separate sub reducer to operate on each slice of the state then combineReducers is used to do this.combineReducers is a nice way to combine sub reducers.
Syntax:
const rootReducer = combineReducers({
key1: value1,
key2: value2
});
Note: inside combineReducers pass plain object.
Example:
const rootReducer = combineReducers({
a: apples,
b: bananas
});
Thanks for posting this article.
ReplyDeleteFull Stack online Training
Full Stack Training
Full Stack Developer Online Training