Skip to content

Instantly share code, notes, and snippets.

@dceddia
Created November 17, 2017 04:30
Show Gist options
  • Save dceddia/faf047339a89f77e804bc52394e900ee to your computer and use it in GitHub Desktop.
Save dceddia/faf047339a89f77e804bc52394e900ee to your computer and use it in GitHub Desktop.
function reducer(state = initialState, action) {
switch(action.type) {
case 'INCREMENT':
return {
count: state.count + 1
};
case 'DECREMENT':
return {
count: state.count - 1
};
default:
return state;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment