Skip to content

Instantly share code, notes, and snippets.

@yelouafi
Created July 26, 2015 12:45
Show Gist options
  • Save yelouafi/0cae8933eab0b8c39ecd to your computer and use it in GitHub Desktop.
Save yelouafi/0cae8933eab0b8c39ecd to your computer and use it in GitHub Desktop.
function likeHandler(state, e) {
if(e.action === 'like')
return {...state, likes: state.likes + 1};
else if(e.action === 'dislike')
return {...state, dislikes: state.dislikes + 1};
return state;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment