DEV Community

Discussion on: In Vue, when do I actually need the :key attribute and why?

Collapse
 
sdevore profile image
Sam DeVore • Edited

another place where it can be important is if you have a collection of divs with v-if, v-else and/or v-else-if and you have them wrapped in a transition otherwise the transition isn't fired and the elements just swap. This one bit me more then once when starting out with Vue (see the note at vuejs.org/v2/guide/transitions.htm... )