mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Changed key from Math.random() to todo.cid
It doesn’t make much sense to generate a random key for each todo render, because it will re-draw all todo’s DOM nodes on each model change. I changed it to the unique identifier ``todo.cid`` already supplied by the backbone model.
This commit is contained in:
@@ -236,7 +236,7 @@ var TodoApp = React.createClass({
|
||||
var todoItems = this.props.todos.map(function(todo) {
|
||||
return (
|
||||
<TodoItem
|
||||
key={Math.random()}
|
||||
key={todo.cid}
|
||||
todo={todo}
|
||||
onToggle={todo.toggle.bind(todo)}
|
||||
onDestroy={todo.destroy.bind(todo)}
|
||||
|
||||
Reference in New Issue
Block a user