updated key logic

This commit is contained in:
Micah Godbolt
2019-02-13 14:13:57 -08:00
parent 5d3c0983dd
commit 24733636ec
3 changed files with 33 additions and 16 deletions

View File

@@ -31,11 +31,9 @@ export class TodoApp extends React.Component<any, any> {
_addTodo = () => {
const { todos, inputValue } = this.state;
const id = todos[0] ? todos[0].id + 1 : 0;
const newTodos = [
{
id: id,
key: id,
id: todos[0] ? todos[0].id + 1 : 0,
text: inputValue
},
...todos