Skip to content

Commit

Permalink
[Docs] jsx-key: split the examples
Browse files Browse the repository at this point in the history
I didn't understand these were three different examples.
  • Loading branch information
ioggstream authored and ljharb committed May 20, 2022
1 parent 527db86 commit c42b624
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Expand Up @@ -10,8 +10,10 @@ This change log adheres to standards from [Keep a CHANGELOG](https://keepachange

### Changed
* [Docs] [`jsx-tag-spacing`]: rename option from [#3264][] ([#3294[] @ljharb)
* [Docs] [`jsx-key`]: split the examples ([#3293][] @ioggstream)

[#3294]: https://github.com/jsx-eslint/eslint-plugin-react/issues/3294
[#3293]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3293
[#3291]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3291

## [7.30.0] - 2022.05.18
Expand Down
10 changes: 10 additions & 0 deletions docs/rules/jsx-key.md
Expand Up @@ -9,9 +9,13 @@ Examples of **incorrect** code for this rule:

```jsx
[<Hello />, <Hello />, <Hello />];
```

```jsx
data.map(x => <Hello>{x}</Hello>);
```

```jsx
<Hello {...{ key: id, id, caption }} />
```

Expand All @@ -21,9 +25,13 @@ Examples of **correct** code for this rule:

```jsx
[<Hello key="first" />, <Hello key="second" />, <Hello key="third" />];
```

```jsx
data.map((x) => <Hello key={x.id}>{x}</Hello>);
```

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

Expand All @@ -43,7 +51,9 @@ Examples of **incorrect** code for this rule:

```jsx
[<></>, <></>, <></>];
```

```jsx
data.map(x => <>{x}</>);
```

Expand Down

0 comments on commit c42b624

Please sign in to comment.