Skip to content

Auto-assigned keys can conflict with user-specified ones #180

@sophiebits

Description

@sophiebits

If you render

<div>
    <span key={1}>hello,</span>
    <span>world</span>
</div>

then React throws a duplicate-key error because the second span ("world") is assigned a key of 1, its index in the div's children.

Presumably it's best to simply avoid specifying only some keys but it would be nice if React could use separate namespaces for different key types (or at least provide a slightly more informative error message).

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