Skip to content

Remove array indexes as keys in JSX list components #2486

@kasya

Description

@kasya

Replace array index usage in key props with stable, unique identifiers for all list components.

Rule: typescript:S6479
Here's a full list of issues we have under this rule.

Why?

  • Performance issues: Array indexes cause unnecessary DOM recreation when item order changes
  • State bugs: Component state can become mismatched when items are reordered, added, or removed
  • React reconciliation problems: React cannot properly track component identity across renders
  • Unpredictable behavior: Leads to subtle bugs that are difficult to debug

Scope

  • Replace with stable unique identifiers (IDs, UUIDs, or other unique properties)
  • If items lack unique IDs, add them to the data structure

Notes

  • May require backend changes to provide unique identifiers

Are you going to work on fixing this?

  • Yes
  • No

Metadata

Metadata

Assignees

Type

Projects

Status

In progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions