1// reducers.js
2export default theDefaultReducer = (state = 0, action) => state
3
4export const firstNamedReducer = (state = 1, action) => state
5
6export const secondNamedReducer = (state = 2, action) => state
7
8// rootReducer.js
9import { combineReducers, createStore } from 'redux'
10
11import theDefaultReducer, {
12 firstNamedReducer,
13 secondNamedReducer
14} from './reducers'
15
16// Use ES6 object literal shorthand syntax to define the object shape
17const rootReducer = combineReducers({
18 theDefaultReducer,
19 firstNamedReducer,
20 secondNamedReducer
21})
22
23const store = createStore(rootReducer)
24console.log(store.getState())
25// {theDefaultReducer : 0, firstNamedReducer : 1, secondNamedReducer : 2}