Last active
May 3, 2018 05:06
-
-
Save masa7351/8f594dd02968b117e5d46bc2ea332060 to your computer and use it in GitHub Desktop.
createReducerを使用したReducerの書き方 - パート2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default createReducer(initialState, { | |
[types.INCREMENT](state) { | |
return Object.assign({}, state, {value: state.value + 1}); | |
}, | |
[types.DECREMENT](state) { | |
return Object.assign({}, state, {value: state.value - 1}); | |
}, | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { combineReducers } from 'redux'; | |
import counter from './counter'; | |
const rootReducer = combineReducers({ | |
counter, | |
}); | |
export default rootReducer; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment