Modified the todo example.
Instead of only using the index to supress the warning it now uses the text + index to also ensure object iteration order.
PNikray committed
Mar 2, 2015 at 19:49 UTC
3516f33ffd8d51be904032b2e4ca26c28b09ff66
1 file changed
+1
-1
docs/_js/examples/todo.js
+1
-1
@@ -2,7 +2,7 @@ var TODO_COMPONENT = `
2
var TodoList = React.createClass({
3
render: function() {
4
var createItem = function(itemText, index) {
5
- return <li key={index}>{itemText}</li>;
5
+ return <li key={index + itemText}>{itemText}</li>;
6
};
7
return <ul>{this.props.items.map(createItem)}</ul>;
8
}