Skip to content

Instantly share code, notes, and snippets.

@codewithbernard
Created February 24, 2018 17:14
Show Gist options
  • Select an option

  • Save codewithbernard/40b15b81d271d47c4b18cc7a24d28d66 to your computer and use it in GitHub Desktop.

Select an option

Save codewithbernard/40b15b81d271d47c4b18cc7a24d28d66 to your computer and use it in GitHub Desktop.
handleSubmit = (event) => {
event.preventDefault()
const meal = this.state.meal;
if (this.state.meals.indexOf(meal) === -1) {
this.setState({
meals: [...this.state.meals, meal],
meal: ""
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment