Skip to content

Commit 104523b

Browse files
authored
Update jsx-key.md
Using an index for a key is a violation of the [no-array-index-key](https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-array-index-key.md) lint rule
1 parent 7dfcbfb commit 104523b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

docs/rules/jsx-key.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Examples of **correct** code for this rule:
2222
```jsx
2323
[<Hello key="first" />, <Hello key="second" />, <Hello key="third" />];
2424

25-
data.map((x, i) => <Hello key={i}>{x}</Hello>);
25+
data.map(x => <Hello key={x.id}>{x}</Hello>);
2626

2727
<Hello key={id} {...{ id, caption }} />
2828
```

0 commit comments

Comments
 (0)