Warning for missing "key" prop
See original GitHub issueHello, I tried your library, which is great so far to replace JSX. I have an issue with the “key” property, as soon as I pass more than one component in the array of children, I have the warning that I need to add a “key” prop to each children. I’m pretty sure it’s not needed with JSX when you declare components without explicitly passing an array :
// key prop is added automatically I suppose ?
return (
<div>
<Component1 />
<Component2 />
</div>
)
So my question is, is it possible to add this key prop automatically ?
Issue Analytics
- State:
- Created 8 years ago
- Comments:14 (8 by maintainers)
Top Results From Across the Web
eslint: Missing "key" prop for element in iterator (react/jsx-key)
I am not sure if I did this properly, but I have assigned a unique ID number for each person in the user...
Read more >react_missing_key_prop - Rule | DeepScan
This rule applies when key prop is missing at each element inside the children of a React element. In React, rendering is optimized...
Read more >jsx-key `Missing "key" prop for element in array` when there is ...
Hello, I just upgraded eslint-plugin-react from 7.28.0 to 7.29.0 The result is I now get a Missing "key" prop for element in array...
Read more >Warning: Each Child in a List Should Have a Unique 'key' Prop
Learn what causes"Warning: Each child in a list should have a unique 'key' prop."
Read more >1336621 - React missing key warnings in Frame and StackTrace
... react-dev.js:22807:9 16:52:21.955 "Warning: Each child in an array or iterator should have a unique "key" prop. Check the render method of `StackTrace`....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
We did upgrade, but removing the manual
keys
attribute shows the warning. Should I have these or not? Here’s for example a render that without the mnaul keys would complain:Would anyone mind giving a sample into how to use it properly to avoid the keys warning? We are adding the key manually, but it feel wrong. I was looking through the issues to to see if there was something related and came to this, but unfortunately I cannot figure how to do it without manual keying of elements.