Add information on JSX element keys (#6751)
Chad Fawcett committed
May 12, 2016 at 17:02 UTC
5d64199bb6d5a875206cdcc552cdcb4bf32c7e97
1 file changed
+2
-2
docs/docs/02.3-jsx-gotchas.md
+2
-2
@@ -40,10 +40,10 @@ A safer alternative is to find the [unicode number corresponding to the entity](
40
<div>{'First ' + String.fromCharCode(183) + ' Second'}</div>
41
```
42
43
-You can use mixed arrays with strings and JSX elements.
43
+You can use mixed arrays with strings and JSX elements. Each JSX element in the array needs a unique key.
44
45
```javascript
46
-<div>{['First ', <span>·</span>, ' Second']}</div>
46
+<div>{['First ', <span key="middot">·</span>, ' Second']}</div>
47
```
48
49
As a last resort, you always have the ability to [insert raw HTML](/react/tips/dangerously-set-inner-html.html).