Created
October 20, 2018 14:09
-
-
Save lomse/ca4d1a33ddc49dc9c07bba7440b00467 to your computer and use it in GitHub Desktop.
Handle submit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
handleSubmit = evt => { | |
evt.preventDefault() | |
const { currentTodo, todos } = this.state | |
const newTodo = { id: generateId(), name: currentTodo, isComplete: false } | |
const updatedTodos = addTodo(todos, newTodo) | |
this.setState({ todos: updatedTodos, currentTodo: '' }) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment