Commit fa5737cedebd6f643eba41cf8e169882050cd3f7
add keys to react component lists
Michael Williams committed on 1/10/2016, 4:46:31 AMParent: 75102438a0ff6dfd7a7e43faa8565c79b67612b9
Files changed
app/todos/components/todo-list.js | changed |
app/todos/containers/index.js | changed |
app/todos/components/todo-list.js | ||
---|---|---|
@@ -3,10 +3,10 @@ | ||
3 | 3 | export default class TodoList extends React.Component { |
4 | 4 | render () { |
5 | 5 | return <ul> |
6 | 6 | { |
7 | - React.Children.map(this.props.children, todo => { | |
8 | - return <li>{ todo }</li> | |
7 | + React.Children.map(this.props.children, (todo, todoKey) => { | |
8 | + return <li key={todoKey}>{ todo }</li> | |
9 | 9 | }) |
10 | 10 | } |
11 | 11 | </ul> |
12 | 12 | } |
Built with git-ssb-web