Skip to content

Commit

Permalink
Merge pull request ruanyf#36 from ReedSun/master
Browse files Browse the repository at this point in the history
add key for Array which randered
  • Loading branch information
ruanyf authored May 4, 2017
2 parents 2d19ffd + 479765c commit 15a5be3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions demo02/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
ReactDOM.render(
<div>
{
names.map(function (name) {
return <div>Hello, {name}!</div>
names.map(function (name, index) {
return <div key={index}>Hello, {name}!</div>
})
}
</div>,
Expand Down
4 changes: 2 additions & 2 deletions demo03/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
<div id="example"></div>
<script type="text/babel">
var arr = [
<h1>Hello world!</h1>,
<h2>React is awesome</h2>,
<h1 key="1">Hello world!</h1>,
<h2 key="2">React is awesome</h2>,
];
ReactDOM.render(
<div>{arr}</div>,
Expand Down

0 comments on commit 15a5be3

Please sign in to comment.