Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save rafaellucio/0bc10ae191ff3ed3a58358a2347265f9 to your computer and use it in GitHub Desktop.
Save rafaellucio/0bc10ae191ff3ed3a58358a2347265f9 to your computer and use it in GitHub Desktop.
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