Created
December 8, 2017 13:00
-
-
Save vzaidman/6fd7e79c9900bf44b2e625f2e57e9dd9 to your computer and use it in GitHub Desktop.
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
// redux-toolbelt action creator is imported directly to the reducer | |
import {increaseBy} from './actions' | |
export default countReducer = (state = deafaultState, {payload, type}) => { | |
switch(type){ | |
// the action creator is used inside the reducer to get it's type | |
case increaseBy.TYPE: | |
return { | |
...state, | |
count: state.count + payload | |
} | |
default: | |
return state | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment