Vue.js High-Level Interview Q&A (Top 30)
1. What is Vue.js architecture based on?
Vue follows the MVVM (Model-View-ViewModel) pattern, where:
- Model → Data
- View → UI (template)
- ViewModel → Vue instance (reactivity bridge)
2. Explain Vue reactivity system (deep concept)
Vue uses:
- Vue 2:
Object.defineProperty - Vue 3:
Proxy
Vue tracks dependencies and automatically updates DOM when data changes.
3. What is Virtual DOM in Vue?
Virtual DOM is a lightweight JS representation of real DOM.
👉 Vue compares old vs new VDOM (diffing) and updates only changed parts.
4. Difference between Vue 2 and Vue 3?
| Feature | Vue 2 | Vue 3 |
|---|---|---|
| Reactivity | defineProperty | Proxy |
| API | Options API | Composition API |
| Performance | Moderate | Faster |
| Tree-shaking | No | Yes |
5. What is Composition API?
A new way to organize logic using:
setup() {
const count = ref(0)
return { count }
}
Better for:
- Code reuse
- Large projects
6. Difference: ref vs reactive?
ref()→ primitive valuesreactive()→ objects
7. What is computed vs watch?
- computed: cached, derived state
- watch: side effects
8. What is nextTick?
Executes code after DOM update:
await nextTick()
9. Explain lifecycle hooks (Vue 3)
- onMounted
- onUpdated
onUnmounted
10. What is v-model internally?
Two-way binding using:
:modelValue + @update:modelValue
11. What is Teleport?
Render component outside DOM hierarchy:
<teleport to="body">
12. What are slots?
Used for content distribution:
- default
- named
- scoped
13. What is scoped slot?
Pass data from child → parent via slot.
14. What is provide/inject?
Dependency injection system in Vue.
15. What is Pinia?
Modern state management (Vuex replacement)
16. Difference: Vuex vs Pinia?
- Pinia → simpler, modular, no mutations
- Vuex → complex, strict pattern
17. What is SSR?
Server Side Rendering improves:
- SEO
- performance
Used via Nuxt.js
18. What is hydration?
Client attaches JS to SSR HTML.
19. What is Suspense?
Handles async components:
<Suspense>
20. What is KeepAlive?
Caches component state.
21. What is dynamic component?
<component :is="compName" />
22. What are directives?
Custom behavior:
v-focus
23. What is mixin problem?
- Naming conflicts
- Hard to debug
👉 replaced by Composition API
24. What is tree-shaking?
Removes unused code → smaller bundle.
25. What is code splitting?
Lazy loading components:
const Comp = () => import('./Comp.vue')
26. What is emits in Vue 3?
Declare events:
emits: ['submit']
27. What is shallowRef?
Tracks only top-level changes.
28. What is markRaw?
Exclude object from reactivity.
29. What is effect scope?
Control lifecycle of reactive effects.
30. Performance optimization techniques?
- Lazy loading
- v-memo
- keep-alive
- debounce watch
- optimize computed
💡 Pro Interview Tips
- Always compare Vue 2 vs Vue 3
- Explain why, not just what
- Mention real-world use cases
- Talk about performance & scalability

0 Comments