Skip to content
Critiq Docs

Search docs

Search documentation pages and rules

correctness.ui

Avoid array index keys in dynamic lists

Using the map index as a React key breaks reconciliation when lists reorder, filter, or insert items.

#Metadata

Rule ID
ts.react.no-index-as-key-in-dynamic-list
Severity
medium
Confidence
0.78
Languages
javascript, typescript
Presets
strict
Stability
experimental
Applies to
function
Tags
react, rules-catalog, ui

#Why it matters

Stable keys help React preserve component state and reduce subtle UI bugs when list membership changes.

#Remediation

Use a stable business identifier from each item, or derive a stable key when the dataset truly never mutates order.

#Repository path

The generated metadata points to critiq-rules/libs/rules/catalog/rules/typescript/ts.react.no-index-as-key-in-dynamic-list.rule.yaml.