Closed Shobhit1 closed 5 years ago
Given that key help react identify which items have changed and React recommends that we do not add array indices as key, its probably a good idea that this rule is implemented as part of this library.
Explanation on Keys: https://reactjs.org/docs/lists-and-keys.html#keys
Negative impact of using array indices: https://medium.com/@robinpokorny/index-as-a-key-is-an-anti-pattern-e0349aece318
Similar rule is implemented in eslint-plugin-react: https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-array-index-key.md.
This should really be a rule!
Sounds like a good idea, but we are closing requests for new rules due to the deprecation timeline: #210
Given that key help react identify which items have changed and React recommends that we do not add array indices as key, its probably a good idea that this rule is implemented as part of this library.
Explanation on Keys: https://reactjs.org/docs/lists-and-keys.html#keys
Negative impact of using array indices: https://medium.com/@robinpokorny/index-as-a-key-is-an-anti-pattern-e0349aece318
Similar rule is implemented in eslint-plugin-react: https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-array-index-key.md.