As mentioned in the official documentation
The key special attribute is primarily used to help Vue's virtual DOM algorithm identify vnodes when comparing the new and old lists of nodes.
It is also important for:
- Properly triggering lifecycle hooks of a component
- Triggering transitions
The key requirement is that keys must be unique and not have any duplicates.
Children of the same parent must have unique keys to avoid render errors.
It is recommended to add a unique identifier to each item, such as an id from the database.
<span v-for="item in FooVar" :key="item.id">
If you do not have an id, you can use the index of the item in the list.
Keep in mind that using the index as the key is NOT optimized, learn more here
<span v-for="(item, index) in FooVar" :key="index">