mirror of
https://github.com/reactjs/react.dev.git
synced 2026-02-24 04:33:10 +00:00
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:
@@ -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>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user