Skip to content

react/jsx-key is triggering false positive for props defined as an object properties #1753

Closed
@awthwathje

Description

@awthwathje

Sometimes it is useful to define a component call as

<Component {...{ key: id, id, shortTitle }} />

instead of

<Component key={id} id={id} shortTitle={shortTitle} />

but in the first case ESLint gets mad about the missing key prop, triggering the react/jsx-key rule.

This is the reason why I'm turning this rule off for now. I believe this should be fixed.

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