Skip to content

Add more detail to missing-key warning #6163

Closed
@japgolly

Description

@japgolly

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions