Open jwalkerinterpres opened 2 weeks ago
React version: 8.3.0
Each child in a list should have a unique "key" prop.
Link to code example:
No link needed, it's a single line of code:
<ul>{ [1,2,3].map(num => <li key="sameKey">{num}</li> }</ul>
The warning essentially says "You've got duplicate values". But, React knows exactly what key it saw duplicated, right?
That key (eg. "sameKey" in my example), would be useful for debugging purposes, so why not report it?
"sameKey"
Each child in a list should have a unique "key" prop, but the key "sameKey" was seen at least twice.
Here try to pass the sameKey as num as each num is different. Now you won't get any warnings
React version: 8.3.0
Steps To Reproduce
Link to code example:
No link needed, it's a single line of code:
The current behavior
The expected behavior
The warning essentially says "You've got duplicate values". But, React knows exactly what key it saw duplicated, right?
That key (eg.
"sameKey"
in my example), would be useful for debugging purposes, so why not report it?