Vue · Senior · Question 11 of 75
What goes wrong when v-for uses the index as key and items are inserted at the top?
- ✓Correct answer: Vue reuses nodes by position, so local state (inputs, child components) shifts to the wrong items
- 2Nothing; index keys are recommended
- 3Vue throws a duplicate key error
Explanation
With stable ids Vue moves existing nodes. Index keys only work for static lists or lists without component state.