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.
This commit is contained in:
PNikray
2015-03-02 19:49:42 +01:00
parent 5725676aa7
commit cfe4d1335e

View File

@@ -2,7 +2,7 @@ var TODO_COMPONENT = `
var TodoList = React.createClass({
render: function() {
var createItem = function(itemText, index) {
return <li key={index}>{itemText}</li>;
return <li key={index + itemText}>{itemText}</li>;
};
return <ul>{this.props.items.map(createItem)}</ul>;
}