git ssb

1+

dinoworm ๐Ÿ› / catstack



Commit fa5737cedebd6f643eba41cf8e169882050cd3f7

add keys to react component lists

Michael Williams committed on 1/10/2016, 4:46:31 AM
Parent: 75102438a0ff6dfd7a7e43faa8565c79b67612b9

Files changed

app/todos/components/todo-list.jschanged
app/todos/containers/index.jschanged
app/todos/components/todo-list.jsView
@@ -3,10 +3,10 @@
33 export default class TodoList extends React.Component {
44 render () {
55 return <ul>
66 {
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>
99 })
1010 }
1111 </ul>
1212 }
app/todos/containers/index.jsView
@@ -13,10 +13,10 @@
1313
1414 render () {
1515 return <TodoList>
1616 {
17- map(this.props.todos, todo => {
18- return <Todo todo={todo} />
17+ map(this.props.todos, (todo, todoKey) => {
18+ return <Todo key={todoKey} todo={todo} />
1919 })
2020 }
2121 </TodoList>
2222 }

Built with git-ssb-web