Rules
no-duplicate-key
Full Name in eslint-plugin-react-x
Full Name in @eslint-react/eslint-plugin
Presets
xrecommendedrecommended-typescriptrecommended-type-checked
Description
Disallow duplicate key on elements in the same array or a list of children.
React uses keys to identify elements in an array. If two elements have the same key, React will not be able to distinguish them. This can lead to issues with state and rendering.
Examples
Failing
Passing
Implementation
Further Reading
See Also
no-missing-key
Prevents missingkeyon items in list rendering.no-implicit-key
Preventskeyfrom not being explicitly specified (e.g. spreadingkeyfrom objects).no-array-index-key
Warns when an arrayindexis used as akeyprop.