Created
November 17, 2017 04:31
-
-
Save dceddia/68bfd12ba01916cdd48c080fd7051114 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
function brokenReducer(state = initialState, action) { | |
switch(action.type) { | |
case 'INCREMENT': | |
// NO! BAD: this is changing state! | |
state.count++; | |
return state; | |
case 'DECREMENT': | |
// NO! BAD: this is changing state too! | |
state.count--; | |
return state; | |
default: | |
// this is fine. | |
return state; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment