Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Rule Suggestion: no-array-index-key #184

Closed
Shobhit1 opened this issue Oct 22, 2018 · 2 comments
Closed

New Rule Suggestion: no-array-index-key #184

Shobhit1 opened this issue Oct 22, 2018 · 2 comments

Comments

@Shobhit1
Copy link

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.

@samueldepooter
Copy link

This should really be a rule!

@adidahiya
Copy link
Contributor

Sounds like a good idea, but we are closing requests for new rules due to the deprecation timeline: #210

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants