-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
react/no-array-index-key - Breaking this.props.children in to chunks and using index as a key #1123
Comments
If there's nothing unique about the items, then you'd simply disable the rule with an override. |
@penx If you have a static set it should be ok to use the array index as values. If you have other features (eg. filtering) then it's recommended to use a unique key to avoid index collisions since React uses keys first to check if a node should be updated. |
You can use simple 'hack' |
That’s just defeating the purpose of the rule. Might as well turn it off. |
Are there circumstances when it is ok to use array index as a key? If so, could these exceptions be added to the documentation here:
https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-array-index-key.md
I have run in to an issue where I am breaking down
this.props.children
in to several chunks in order to render them in a grid - but I can't see how I could use anything other than the array index as an identifier - more information here:http://stackoverflow.com/questions/42983067/breaking-children-in-to-chunks-and-react-no-array-index-key
The text was updated successfully, but these errors were encountered: