Created
April 15, 2019 13:18
-
-
Save benkissi/caf955a1dd9cc649da0954aac31ceb43 to your computer and use it in GitHub Desktop.
Context blog
This file contains 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
addTodo(todo) { | |
const { todos } = this.state; | |
const newTodo = { | |
id: Math.floor(Math.random() * (1000 - 1)) + 1, | |
todo: todo, | |
createdAt: Date.now(), | |
completed: false | |
}; | |
this.setState({ | |
todos: todos.concat(newTodo) | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment