Skip to content

Instantly share code, notes, and snippets.

@franzejr
Created March 6, 2016 03:35
Show Gist options
  • Save franzejr/1a9b95d83b2d0f1239b3 to your computer and use it in GitHub Desktop.
Save franzejr/1a9b95d83b2d0f1239b3 to your computer and use it in GitHub Desktop.
Reducer Counter
export default function counter(state = 0, action) {
switch (action.type) {
case 'INCREMENT':
return state + 1
case 'DECREMENT':
return state - 1
default:
return state
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment