mirror of
https://github.com/microsoft/frontend-bootcamp.git
synced 2026-01-26 14:56:42 +08:00
updated key logic
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user