Skip to content

Instantly share code, notes, and snippets.

@abhishekjakhar
Created April 30, 2019 16:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abhishekjakhar/f711174d9eb79920f00763b00936bc88 to your computer and use it in GitHub Desktop.
Save abhishekjakhar/f711174d9eb79920f00763b00936bc88 to your computer and use it in GitHub Desktop.
updateMocktail Method
updateMocktail = mocktail => {
const newMocktail = mocktail;
this.setState(state => {
if (state.mocktail === newMocktail) {
return null;
} else {
return { mocktail };
}
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment