The Delightful World of Vue Part 2
Inventing a Proper v-for :key
  Start your All-Access Pass to unlock this challenge
Buy Access Login

Challenge 1 / 1

In this video, we start with a component that iterates through a list of items using the items' index in the Array as key, like so:

<shopping-cart-item
    v-for="(item, index) in items"
    :key="index"
    :item="item"
/>

But this is not ideal! In a real application, each item should have an id that is unique to that item for the key attribute. But why is this so?

Skip challenges and go to theNext Chapter

Turn Challenges Off?

All further challenges will be skipped automatically.
You can re-enable challenges at any time on this page or from your account page.