Skip to content

Commit cb05e2f

Browse files
committed
Merge pull request facebook#3271 from delftswa2014/fix/todo-example
Added the key attribute into the todo example
2 parents 90f8a89 + 3516f33 commit cb05e2f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

docs/_js/examples/todo.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
var TODO_COMPONENT = `
22
var TodoList = React.createClass({
33
render: function() {
4-
var createItem = function(itemText) {
5-
return <li>{itemText}</li>;
4+
var createItem = function(itemText, index) {
5+
return <li key={index + itemText}>{itemText}</li>;
66
};
77
return <ul>{this.props.items.map(createItem)}</ul>;
88
}

0 commit comments

Comments
 (0)