Rules
no-array-index-key
Full Name in eslint-plugin-react-x
Full Name in @eslint-react/eslint-plugin
Features
🔍
Presets
corerecommendedrecommended-typescriptrecommended-type-checked
What it does
Warns when an array index is used as a key prop.
The order of items in a list rendering can change over time if an item is inserted, deleted, or the array is reordered. Indexes as keys often lead to subtle and confusing errors.
Examples
Failing
Passing
Implementation
Further Reading
See Also
no-missing-key
Prevents missingkeyon items in list rendering.no-duplicate-key
Prevents duplicatekeyon elements in the same array or a list ofchildren.no-implicit-key
Preventskeyfrom not being explicitly specified (e.g. spreadingkeyfrom objects).