Skip to content

Instantly share code, notes, and snippets.

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