Skip to content

Commit

Permalink
Split examples using markdown
Browse files Browse the repository at this point in the history
  • Loading branch information
ioggstream committed May 23, 2022
1 parent d2fb6c9 commit 3a2711c
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion docs/rules/jsx-key.md
Expand Up @@ -5,13 +5,17 @@ array literal or an arrow function expression.

## Rule Details

Three different examples of **incorrect** code for this rule:
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 3a2711c

Please sign in to comment.