Browse Source

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.
main
PNikray 10 years ago
parent
commit
cfe4d1335e
  1. 2
      _js/examples/todo.js

2
_js/examples/todo.js

@ -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>;
}

Loading…
Cancel
Save