Skip to content

Instantly share code, notes, and snippets.

@lupomontero
Last active July 2, 2018 12:05
Show Gist options
  • Save lupomontero/111600f518d34121da8b65853ae300a5 to your computer and use it in GitHub Desktop.
Save lupomontero/111600f518d34121da8b65853ae300a5 to your computer and use it in GitHub Desktop.
const state = { count: 0 };
const reducer = (action) => {
switch (action.type) {
case 'INCREMENT':
state.count++;
break;
case 'DECREMENT':
state.count--;
break;
}
return state;
};
module.exports = reducer;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment