Interview Q&A · questions with model answers
Vue.js Developer Interview Questions
Part of the study plan for: Frontend Engineer
Ordered by how often they're asked. Most-asked answers are free to read in full; members see every answer and can rate their confidence on each.
-
Most asked Options API or Composition API: what is the difference, and which would you use?
The Options API organises a component by option type (data, computed, methods, watch); the Composition API organises it by logical concern using functions (ref, computed, watch) inside setup() or…
-
Most asked ref or reactive: what is the difference, and when do you use each?
ref() wraps any value (primitives included) in an object with a .value property; reactive() makes an object deeply reactive through a Proxy and only works with objects. The Vue docs recommend ref()…
-
Most asked How does Vue 3's reactivity system work, and how does it differ from Vue 2's?
Vue 3 wraps objects in JavaScript Proxies: reading a property inside an effect (a component render, computed, watchEffect) records a dependency (track), and writing the property re-runs the effects…
-
Most asked Pinia or Vuex: what is the difference, and why is Pinia now recommended?
Pinia is the official state management library for Vue 3 (Vuex is in maintenance mode). It drops mutations (actions can change state directly), has a simpler API, first-class TypeScript inference,…
-
Most asked v-if or v-show: what is the difference?
v-if adds and removes the element (and its component instances) from the DOM; v-show always renders it and toggles CSS display. v-if has a higher toggle cost but nothing is rendered when false;…
-
Most asked Vue or React: how would you compare them?
Both are mature, component-based libraries with large ecosystems. Vue uses HTML-like templates compiled with optimisation hints, fine-grained reactivity (mutate state, Vue tracks dependencies) and…
-
What are provide and inject, and when should you use them?
provide makes a value available to every descendant component, and inject reads it, without passing props through every intermediate level (prop drilling). It suits values shared within a component…
-
When would you write a custom directive?
When you need low-level DOM access that is reused across components and is not naturally a component or composable, such as auto-focus (v-focus), click-outside detection, or integrating a small DOM…