Common Mistakes in Vue js and How to Avoid Them
summary
Shows concrete bugs and fixes: using index as key breaks component state when list items reorder and contain internal state — fix by keying with an id/name (demo: shuffled Pokémon cards); DOM transitions need keys to trigger animations (uses VAutoAnimate). Browser APIs like localStorage are nonreactive — demo switches to @vueuse media composable to get reactive playing state. Reassigning a reactive object kills reactivity — recommended use ref everywhere. Avoid mutating object props by cloning (e.g. JSON.parse(JSON.stringify(...))).
AI-written summary · about
