diff --git a/react/README.md b/react/README.md index 747bbe65..3f21dd3b 100644 --- a/react/README.md +++ b/react/README.md @@ -279,6 +279,26 @@
``` + - Avoid using an array index as `key` prop, prefer a unique ID. ([why?](https://medium.com/@robinpokorny/index-as-a-key-is-an-anti-pattern-e0349aece318)) + + ```jsx + // bad + {todos.map((todo, index) => + + )} + + // good + {todos.map((todo) => + + )} + ``` + ## Parentheses - Wrap JSX tags in parentheses when they span more than one line. eslint: [`react/wrap-multilines`](https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/wrap-multilines.md)