question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add more detail to missing-key warning

See original GitHub issue

I have a component in which I must be using an array and not setting keys because I get this warning:

Warning: Each child in an array or iterator should have a unique "key" prop.
Check the render method of `Blah`.
See https://fb.me/react-warning-keys for more information.

The problem is that render methods aren’t always simple and sometimes it’s quite hard to find out where the problematic array is.

It would be awesome it the warning could be enhanced to provide some more information about the problematic dom. Something like:

Warning: Each child in an array or iterator should have a unique "key" prop.
Check the render method of `Blah` when rendering: <ol><li>One</li><li>Two</li></ol>
See https://fb.me/react-warning-keys for more information.

or even

Warning: Each child in an array or iterator should have a unique "key" prop.
Check the render method of `Blah`.
The head element renders to: <li>One</li>
See https://fb.me/react-warning-keys for more information.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
gaearoncommented, Jun 26, 2016

This was fixed in https://github.com/facebook/react/pull/6799—now we have an exact stack trace.

0reactions
troydemonbreuncommented, Mar 23, 2016

Cool, that would be helpful info.

Read more comments on GitHub >

github_iconTop Results From Across the Web

reactjs - Can't find missing key in 'Each child in a list should ...
I've been starring at my code, but I can't see where the key is missing. That is my error: Warning: Each child in...
Read more >
Resolve Missing Key Issues - VMware Docs
If the keys are missing only on the ESXi host, vCenter Server generates a virtual machine alarm and the following message appears in...
Read more >
Missing keys & unexpected keys in state_dict when loading ...
After that I would like to infer some images using my model, it fails with the follow error: RuntimeError: Error(s) in loading state_dict...
Read more >
react_missing_key_prop - Rule | DeepScan
If key prop is missing in each React element when recursing on children of a DOM ... Also in this case, React will...
Read more >
How to Fix 'Each child should have a unique key prop' - Webtips
Learn what is the root cause, and how to fix 'Warning: Each child in a list should have a unique 'key' prop.' warnings...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found