Skip to content

vue-doctor/correctness/no-array-index-as-key ​

Use a stable unique identifier: :key="item.id" — index keys break on reorder/filter

PropertyValue
CategoryCorrectness
Default Severitywarning
Confidencemedium
FixableNo
Engineoxlint
Sincev1.0.0
Frameworksvue, nuxt

Why it matters ​

Use a stable unique identifier: :key="item.id" — index keys break on reorder/filter

How to fix ​

Review the finding and update the code according to best practices below.

Agent Guidance ​

Use a stable unique id from the data, such as :key="item.id", instead of the loop index; index keys break state on reorder, insert and filter.


Rule source: vue-doctor/correctness/no-array-index-as-key

Released under the MIT License.