Created
February 26, 2018 15:34
-
-
Save ShMcK/d971c87c6f1ab6aae8386b38dd1d51e9 to your computer and use it in GitHub Desktop.
Reducer Example
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
const countReducer = (state, action) => { | |
switch(action.type) { | |
case INCREMENT: | |
return state + action.payload | |
case DECREMENT: | |
return state - action.payload | |
default: | |
return state | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment