August 2017
Beginner
298 pages
7h 4m
English
The last item we have left in the reducers part is the root reducer. In this file, all the reducers are combined together to be used as a state for the application. Redux provides a method called combineReducers, which can be used for this purpose. In your rootReducer.js file, add the following import statements:
import { combineReducers } from 'redux';import postsReducer from './postsReducer';import authorsReducer from './authorsReducer';import ajaxCallsReducer from './ajaxCallsReducer';
This will import the combineReducers function along with other reducers. To combine all reducers into a single root reducer, you will simply need to add the following code:
const rootReducer = combineReducers({ posts: postsReducer, authors: ...Read now
Unlock full access