Vue.js Developer interview question · Most asked
What are the main breaking changes when migrating from Vue 2 to Vue 3?
Summary
The app is created with createApp() instead of new Vue(); global APIs moved to the app instance; v-model on components uses modelValue/update:modelValue (and .sync was removed); filters, $on/$off event buses, $listeners and $children were removed; v-if now has priority over v-for; functional and async component syntax changed; and Vue Router 4, Pinia (instead of Vuex 3) and Vite are the standard stack.
Longer Answer
Strategy: upgrade to Vue 2.7 first (it backports the Composition API and <script setup>), remove deprecated patterns, then use the migration build (@vue/compat), which runs Vue 3 with Vue 2 behaviour where possible and logs warnings for each incompatibility. Third-party component libraries are usually the biggest blocker (for example, moving from Vuetify 2 to 3). Vue 2 reached end of life on 31 December 2023, so staying on it means no security fixes.
Key Points
- createApp and app-level APIs.
- v-model and .sync changes; filters and event bus removed.
- Go via Vue 2.7 and @vue/compat.
- Libraries are the main blocker; Vue 2 is EOL.
Explanation
What interviewers look for
Experience with an actual migration: the compat build, library blockers, and incremental strategy.
More most-asked Vue.js Developer questions
- Options API or Composition API: what is the difference, and which would you use?
- How do props work, and what is one-way data flow?
- How does Vue 3's reactivity system work, and how does it differ from Vue 2's?
- computed, watch or watchEffect: when do you use each?
- ref or reactive: what is the difference, and when do you use each?
- How do you use Vue Router: dynamic routes, nested routes and navigation guards?
- Why does v-for need a key, and why should it not be the index?
- What are composables, and why did they replace mixins?