Vue · Junior · Question 61 of 75

Why does v-for need a unique :key?

Explanation

Use a stable id from the data. Without keys, Vue patches in place, which can mix up inputs or component state when the order changes.

Further reading

Problem with a question

Vue · Junior · question 61

Test yourself

Take the Vue · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz