Add information on JSX element keys (#6751)

This commit is contained in:
Chad Fawcett
2016-05-12 17:02:07 -07:00
committed by Jim
parent 0e889d7c72
commit 5d64199bb6

View File

@@ -40,10 +40,10 @@ A safer alternative is to find the [unicode number corresponding to the entity](
<div>{'First ' + String.fromCharCode(183) + ' Second'}</div>
```
You can use mixed arrays with strings and JSX elements.
You can use mixed arrays with strings and JSX elements. Each JSX element in the array needs a unique key.
```javascript
<div>{['First ', <span>&middot;</span>, ' Second']}</div>
<div>{['First ', <span key="middot">&middot;</span>, ' Second']}</div>
```
As a last resort, you always have the ability to [insert raw HTML](/react/tips/dangerously-set-inner-html.html).