Skip to content

Commit

Permalink
[doc] add eslint rule references in react guide
Browse files Browse the repository at this point in the history
* react/jsx-filename-extension
* react/no-array-index-key
  • Loading branch information
1pete authored Oct 4, 2018
1 parent 924dfb2 commit 24da5bb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions react/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ This style guide is mostly based on the standards that are currently prevalent i

## Naming

- **Extensions**: Use `.jsx` extension for React components.
- **Extensions**: Use `.jsx` extension for React components. eslint: [`react/jsx-filename-extension`](https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-filename-extension.md)
- **Filename**: Use PascalCase for filenames. E.g., `ReservationCard.jsx`.
- **Reference Naming**: Use PascalCase for React components and camelCase for their instances. eslint: [`react/jsx-pascal-case`](https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-pascal-case.md)

Expand Down Expand Up @@ -351,7 +351,7 @@ This style guide is mostly based on the standards that are currently prevalent i
<div />
```

- Avoid using an array index as `key` prop, prefer a stable ID.
- Avoid using an array index as `key` prop, prefer a stable ID. eslint: [`react/no-array-index-key`](https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-array-index-key.md)

> Why? Not using a stable ID [is an anti-pattern](https://medium.com/@robinpokorny/index-as-a-key-is-an-anti-pattern-e0349aece318) because it can negatively impact performance and cause issues with component state.

Expand Down

0 comments on commit 24da5bb

Please sign in to comment.