Technology interview warm-up

Vue.js Interview Questions and Answers

Vue.js interview questions and Vue JS answers for Vue 3 rounds, with short answers, reactivity scenarios, Composition API, Router, Pinia/Vuex, testing, security, performance, and coding prompts.

Reviewed May 20, 2026FrontendAtlas Editor65 visible Vue.js questions across reactivity, Composition API, component contracts, Router, Pinia/Vuex, scenarios, modern Vue, testing, security, and performance

On this page

Popular clusters

Popular Vue.js interview question clusters

Jump to Vue-specific interview areas: reactivity, Composition API, component contracts, Router, Pinia/Vuex, scenarios, testing, security, and performance.

Short answers

Top Vue.js interview questions and short answers, beginner to advanced

Review Vue 3 fundamentals, reactivity, component contracts, Router, Pinia/Vuex, Composition API, and performance before opening deeper practice routes.

Fundamentals Beginner

What is Vue.js?

Vue.js is a progressive JavaScript framework for building reactive user interfaces with components. Vue tracks reactive state, renders templates, and patches the DOM when dependencies change. Its practical strength is that simple components stay approachable while larger apps can add Router, Pinia, composables, testing, and build tooling as needed.

Review Vue concepts →
Modern Vue Intermediate

What is the difference between Vue 2 and Vue 3?

Vue 3 introduced a Proxy-based reactivity system, the Composition API, better TypeScript support, fragments, Teleport, Suspense, and a faster runtime. Vue 2 used Object.defineProperty-based reactivity and the Options API as the dominant authoring model. The compatibility concern is that migrations can expose plugin, lifecycle, state-management, and template-assumption differences.

Review Vue 3 patterns →
Reactivity + rendering Intermediate

How does Vue reactivity work?

Vue tracks reactive reads during rendering or effects and triggers the dependent work when those values are written. In Vue 3, proxies let Vue observe object property access and updates more flexibly than Vue 2. The important edge case is that extracting values out of a reactive proxy can disconnect them from tracking unless you preserve refs.

Review reactivity →
Reactivity + rendering Intermediate

What is the difference between ref and reactive?

ref wraps a value in an object with a .value property, while reactive returns a proxy for object-shaped state. ref is usually clearer for primitives and replaceable values; reactive can be convenient when mutating properties on a stable object. Destructuring reactive state can break reactivity, so toRef or toRefs may be needed when extracting fields.

Compare ref and reactive →
Reactivity + rendering Beginner

What are computed properties in Vue?

Computed properties are cached derived values based on reactive dependencies. They rerun only when a dependency changes, which makes them better than methods for values used repeatedly in templates. Computed getters should stay pure and synchronous; side effects belong in watch or watchEffect.

Review computed values →
Reactivity + rendering Intermediate

What happens when methods are called in Vue templates?

A method called from a template can run again whenever the component renders. That is fine for cheap event handlers or formatting, but it is risky for expensive derived values. If the value is derived from reactive state and should be cached, computed is usually the better fit.

Review template methods →
Reactivity + rendering Intermediate

When should you use watch in Vue?

Use watch when a reactive value changing should trigger an imperative side effect such as fetching, logging, writing to storage, or syncing external state. A watcher can observe a specific source and gives access to new and old values. It is the wrong tool for pure derived display state, where computed is simpler and safer.

Compare computed and watch →
Reactivity + rendering Advanced

What is watchEffect in Vue?

watchEffect automatically tracks reactive values read during its callback and reruns when any of them change. It is useful when dependencies are natural to read inside the effect, but it can be less explicit than watch. A common failure is creating loops by writing to the same reactive state the effect reads.

Review watchEffect traps →
Reactivity + rendering Intermediate

What does nextTick do in Vue?

nextTick waits until Vue has flushed pending DOM updates from reactive state changes. It is useful when you need to focus, measure, or scroll after the DOM reflects new state. It should not be used as a general fix for unclear data flow; first explain why DOM timing is the actual dependency.

Review nextTick timing →
Components Beginner

What are Vue lifecycle hooks?

Lifecycle hooks run at specific points in a component lifecycle, such as creation, mount, update, and unmount. They help place setup, DOM-dependent work, subscriptions, and cleanup at the correct time. Bugs often come from reading DOM too early or forgetting to clean up timers, listeners, and external subscriptions.

Review lifecycle hooks →
Components Beginner

What are components in Vue?

Vue components are reusable UI units that combine template, state, behavior, styles, and a public contract. Single-file components make that contract easier to maintain by keeping the component implementation in one file. The component should expose clear props and emits instead of letting children mutate parent-owned state directly.

Review component scope →
Components Intermediate

How should props work in Vue?

Props are inputs owned by the parent and passed down to a child. A child should treat props as read-only and emit an event when it wants the parent to change state. Mutating props directly creates ownership confusion and can be overwritten on the next parent update.

Review prop ownership →
Components Intermediate

Why should emits be declared in Vue?

Declaring emits documents the events a component can send and helps catch mistakes in event names or payload expectations. It also separates component events from native DOM events. In larger codebases, explicit emits make component contracts safer to refactor.

Review emits contracts →
Components Intermediate

What are slots in Vue?

Slots let a parent provide content to a child component while the child controls placement. Named slots support multiple content regions, and scoped slots let the child expose data back to the parent render scope. The trade-off is that too many slot contracts can make component behavior harder to trace.

Review Vue slots →
Components Advanced

When should you use provide and inject?

provide and inject pass dependencies through a component tree without threading props through every level. They fit design-system services, form context, deeply nested wiring, or plugin-style dependencies. They can hide coupling, so app-wide business state is often clearer in a store such as Pinia.

Review provide/inject →
Components Intermediate

What does v-model expand to?

v-model is syntax sugar for binding a value and listening for an update event. On custom components, it usually maps to a modelValue prop and update:modelValue event, with support for named models and modifiers. Understanding the expansion helps debug controlled form components and event payload bugs.

Review v-model internals →
Reactivity + rendering Beginner

What is the difference between v-if and v-show?

v-if conditionally creates and destroys DOM and component instances, while v-show keeps the element mounted and toggles display. v-if is better when the block is rarely shown, and v-show is better for frequent visibility toggles. State reset and lifecycle cleanup are the key behavioral differences.

Compare visibility strategies →
Reactivity + rendering Intermediate

Why are keys important in v-for lists?

Keys give Vue stable identity for list items across insertions, removals, and reordering. Without stable keys, Vue may reuse DOM or component state for the wrong item. Index keys are fragile for dynamic lists because identity changes when order changes.

Review list keys →
Fundamentals Beginner

What are Vue directives?

Directives are template instructions such as v-bind, v-on, v-if, v-for, v-model, and v-show. They compile into reactive behavior that connects state, events, attributes, rendering, and visibility. Custom directives are useful for direct DOM behavior, but they should not replace component state flow.

Review directives →
Modern Vue Intermediate

What is the Composition API?

The Composition API lets Vue components organize logic around features using setup, refs, reactive state, computed values, watchers, and composables. It is especially useful when one feature spans state, lifecycle, and side effects. The main benefit is maintainability and reuse, not simply replacing Options API syntax.

Review Composition API →
Modern Vue Intermediate

What are composables in Vue?

Composables are functions that encapsulate reusable Composition API logic. They can own refs, computed values, watchers, lifecycle hooks, and cleanup behavior. A good composable has a clear ownership boundary and does not hide surprising global state unless that is its explicit purpose.

Review reuse patterns →
Router + state Intermediate

What is Vue Router used for?

Vue Router manages client-side navigation, route matching, nested views, params, query state, and navigation guards. It lets a Vue app behave like multiple pages while avoiding full document reloads. Route guards should have clear allowed, denied, and redirect outcomes to avoid navigation loops.

Review Vue Router →
Router + state Advanced

When should you use Pinia or Vuex?

Use local component state until state must be shared across distant components, persisted, debugged centrally, or coordinated through a predictable update path. Pinia is the modern Vue 3 default, while Vuex still appears in older applications. The key decision is state ownership, not moving every value into a global store.

Review store boundaries →
Reactivity + rendering Advanced

How does Vue virtual DOM diffing work?

Vue renders a virtual node tree and compares the next tree with the previous one to decide what DOM patches are needed. Stable keys help Vue preserve the correct item and component identity during list changes. Diffing is efficient, but it cannot fix unclear identity or excessive reactive dependencies.

Review Vue diffing →
Modern Vue Advanced

How do you improve Vue performance?

Start by reducing unnecessary reactive work, using computed values for cached derived state, keeping keys stable, splitting heavy components, and avoiding expensive template methods. For large lists, use pagination, windowing, or server-side constraints instead of rendering everything. Measure before optimizing because many Vue bottlenecks are data-shape or component-boundary problems.

Open Vue prep path →

Beginner to experienced

Vue.js interview questions for beginners and experienced developers

Use the level chips to move from template and component fundamentals into reactivity traps, application architecture, testing, security, and performance.

Vue.js interview questions for beginners

Start with Vue templates, directives, components, props, emits, v-model, computed values, watchers, lifecycle hooks, and the difference between v-if, v-show, and v-for keys.

Vue.js interview questions for experienced developers

Move into reactivity traps, Composition API design, composables, Router guards, Pinia/Vuex boundaries, SSR/Nuxt hydration, testing, security, performance, and production debugging scenarios.

Reactivity + rendering

Vue reactivity and rendering interview questions

Review how Vue tracks dependencies, batches DOM updates, preserves list identity, and patches the DOM when reactive state changes.

Intermediate

How does Vue know which component to update?

Vue tracks which reactive values are read while rendering or while running an effect. When one of those values changes, Vue schedules the dependent component or effect instead of rerendering everything immediately. The practical debugging step is to find which reactive read created the dependency.

Review dependency tracking →
Advanced

Why can destructuring break Vue reactivity?

Destructuring a property out of a reactive object can copy the current value out of the proxy. Later reads may no longer go through Vue tracking, so updates can appear stale. Use toRef or toRefs when extracted properties must remain reactive.

Debug destructuring →
Intermediate

Why should computed values avoid side effects?

Computed getters are meant to return cached derived state from reactive inputs. If a computed getter writes state, fetches data, or mutates external resources, rendering can become unpredictable. Use watch or watchEffect for side effects and keep computed values pure.

Compare computed and watch →
Intermediate

Why does nextTick matter for DOM reads?

Vue batches reactive updates and patches the DOM asynchronously. Reading or focusing DOM immediately after changing state can see the old DOM. nextTick waits for the pending patch, which makes it useful for focus, measurement, and scroll logic.

Review DOM timing →
Intermediate

How does v-if affect component lifecycle?

v-if creates and destroys the element or component as the condition changes. That means child state resets, mounted and unmounted hooks can run, and cleanup must be correct. Use v-show when preserving state and avoiding repeated lifecycle work matters more than removing DOM.

Review v-if behavior →
Intermediate

How do keys affect state preservation?

Keys tell Vue which item or component instance is the same across renders. Stable keys preserve the right local state during reorder, insertion, and deletion. Unstable or index keys can attach input state, animation state, or component state to the wrong data item.

Review keyed lists →
Advanced

What does Vue virtual DOM diffing optimize?

Vue compares virtual nodes to patch only the DOM regions that changed. Static analysis and keyed identity help Vue skip or narrow work. Diffing still depends on clear state and stable identity; it cannot guess business meaning when keys are wrong.

Review diffing →
Advanced

How are Vue DOM updates batched?

Vue queues reactive updates and flushes DOM patches together to avoid unnecessary repeated work. Multiple state writes in the same tick can produce one DOM update. This improves performance but means DOM-dependent code must wait for the flush when timing matters.

Review rendering pipeline →

Component contracts

Vue component contract interview questions

Cover props, emits, slots, provide/inject, v-model, single-file components, public APIs, and scalable component boundaries.

Intermediate

Why should child components avoid mutating props?

Props are parent-owned inputs, so mutating them inside a child creates two unclear owners for the same state. Vue may warn, and the next parent render can overwrite the child mutation. Emit an event that describes intent and let the parent update its state.

Review prop ownership →
Intermediate

What is the difference between native and component events?

Native events come from DOM elements, while component events are emitted by Vue components as part of their public API. Component events do not automatically bubble like DOM events. Declaring emits makes that boundary explicit and easier to type or refactor.

Compare event boundaries →
Intermediate

How do scoped slots change component design?

Scoped slots let a child expose data while the parent controls how that data is rendered. This is useful for reusable list, table, and layout components. The trade-off is that the parent becomes responsible for rendering details, so the slot contract must stay clear.

Review scoped slots →
Advanced

What is the hidden cost of provide/inject?

provide/inject reduces prop drilling but creates an implicit dependency between ancestor and descendant. That can make data flow harder to discover and test. Use it for stable context-like dependencies, not as a replacement for every shared state problem.

Review provide/inject →
Intermediate

How should v-model be designed on custom components?

A custom component should treat its model prop as an input and emit update events when the user changes it. It should not mutate the model prop directly. Named models and modifiers can support richer contracts, but the one-way ownership pattern still matters.

Review v-model expansion →
Intermediate

Why do single-file components help maintainability?

Single-file components keep template, script, and style for a component in one explicit module. They make ownership, imports, and local styles easier to reason about than broad global registration. Global components still fit truly shared primitives, but feature components should usually remain local.

Review SFC trade-offs →
Beginner

What should a Vue component public API include?

A component public API is mostly its props, emits, slots, and exposed behavior. The API should describe what the parent can control and what events the child can request. Internal refs, watchers, and DOM details should not leak unless the component is intentionally exposing them.

Review emits contracts →
Advanced

How do component boundaries affect scalability?

Vue apps scale better when state ownership, feature boundaries, and component contracts are explicit. A flat global store or broad provide/inject tree can hide too much coupling. Clear component boundaries make tests, refactors, and route-level loading safer.

Review architecture choices →

Scenarios + code

Vue scenario and code interview questions

Practice Vue debugging scenarios around reactivity extraction, watcher loops, key identity, prop ownership, nextTick, v-if lifecycle, computed side effects, and async race conditions.

Advanced

Why does this destructured value stop updating?

const state = reactive({ count: 0 });
const { count } = state;

function increment() {
  state.count++;
}

count is copied out of the reactive proxy, so reads of count no longer go through Vue tracking. Use toRef(state, "count") or toRefs(state) when the extracted value must remain reactive.

Fix destructuring →
Advanced

Why can this watcher loop forever?

watchEffect(() => {
  total.value = items.value.length + total.value;
});

The effect reads total and writes total, so the write can retrigger the same effect. Derived values should be computed, while effects should avoid writing to the same reactive values they depend on.

Review watchEffect loops →
Intermediate

Why can this list keep the wrong input value?

<li v-for="(item, index) in items" :key="index">
  <input v-model="item.name">
</li>

The index key changes meaning when items are inserted, removed, or reordered. Vue can reuse DOM and component state for the wrong item. Use a stable item id as the key.

Debug index keys →
Intermediate

Why is this prop mutation fragile?

const props = defineProps<{ user: { name: string } }>();

function rename() {
  props.user.name = 'Ada';
}

The child is mutating parent-owned data through an object prop. That hides the update from the component contract and can be overwritten by the parent. Emit an intent event or ask the parent to pass a dedicated update callback.

Review prop mutation →
Intermediate

Why does this focus call miss the input?

editing.value = true;
inputRef.value?.focus();

Changing editing schedules a DOM update, but the input may not exist until Vue flushes that update. Await nextTick before focusing the element. This is a timing issue, not a reason to delay every state change.

Review nextTick →
Intermediate

Why does this form reset when toggled?

<ProfileForm v-if="showProfile" />

v-if destroys and recreates the component, so local form state resets. If the form should preserve state while hidden, v-show or lifting the state may be a better choice. The correct answer depends on whether reset is desired.

Compare v-if and v-show →
Advanced

Why is this computed property unsafe?

const fullName = computed(() => {
  analytics.track('full-name-read');
  return first.value + ' ' + last.value;
});

Computed getters can run during rendering and should remain pure. Tracking analytics inside the getter creates a side effect tied to rendering and cache invalidation. Use watch when a state change should trigger external work.

Review computed purity →
Advanced

Why can this search show stale results?

watch(query, async (value) => {
  results.value = await searchUsers(value);
});

A slower previous request can resolve after a newer request and overwrite the latest results. Track request identity, cancel stale work when possible, or ignore responses that no longer match the current query.

Practice debounced search →

Modern Vue 3

Modern Vue 3 interview questions

Review current Vue topics through production trade-offs: script setup, composables, Pinia, Router 4 guards, Teleport, Suspense, SSR, Nuxt, and hydration.

Intermediate

How does Composition API differ from Options API?

Options API organizes code by option type, such as data, computed, methods, and hooks. Composition API organizes related feature logic together inside setup and composables. Options API can still be fine, but Composition API is usually easier to scale when logic is reused or split by feature.

Review Composition API →
Intermediate

What does script setup improve?

script setup is a compile-time syntax for writing Composition API components with less boilerplate. Top-level bindings are directly available to the template, and defineProps and defineEmits make component contracts concise. The trade-off is that developers must understand the compile-time macros instead of treating them like normal runtime functions.

Review setup patterns →
Advanced

What makes a good Vue composable?

A good composable has a clear input and output contract, owns cleanup for side effects it creates, and does not hide surprising shared state. It should be reusable without forcing a component structure. If every consumer needs different lifecycle or ownership rules, the abstraction may be too broad.

Review reuse trade-offs →
Advanced

Why is Pinia the modern default over Vuex?

Pinia has a simpler API, strong TypeScript ergonomics, and fits Vue 3 Composition API patterns well. Vuex still appears in existing apps and teaches useful centralized-state concepts. Migration should focus on store boundaries and update flow, not only syntax replacement.

Review store boundaries →
Intermediate

What changed with Vue Router 4 style guards?

Vue Router 4 encourages returning values from guards instead of relying on next callbacks everywhere. This makes allowed, redirected, and canceled navigation outcomes clearer. Guard code still needs careful async handling to avoid loops or unresolved navigation.

Review router flow →
Advanced

What is Teleport used for in Vue?

Teleport renders part of a component subtree somewhere else in the DOM, such as moving a modal to a root overlay container. It keeps logical component ownership while changing DOM placement. Focus management, stacking, and cleanup still need to be handled correctly.

Open Vue prep path →
Advanced

What is Suspense used for in Vue?

Suspense can coordinate fallback UI while async dependencies inside a component tree resolve. It is useful around async setup and route-level loading patterns. The boundary placement matters because too broad a boundary hides too much UI and too narrow a boundary can create noisy loading states.

Open Vue prep path →
Advanced

How do SSR and Nuxt affect Vue interviews?

SSR renders HTML on the server, then the client hydrates it into an interactive Vue app. Nuxt adds routing, data loading, SSR conventions, and deployment structure around Vue. Hydration bugs often come from different server and client output, browser-only data during initial render, or unstable IDs.

Open Vue prep path →

Testing + security + performance

Vue testing, security, and performance interview questions

Cover Vue Test Utils, Vitest, async DOM updates, emitted events, v-html safety, rich text, profiling, and memory cleanup.

Intermediate

How should Vue component behavior be tested?

Test user-visible behavior through rendered output, interactions, emitted events, validation states, loading, and errors. Vue Test Utils helps mount components and interact with them, while tests should avoid depending on private implementation details. The goal is to prove the component contract, not the exact internal ref names.

Open Vue prep path →
Intermediate

How do Vitest and Vue Test Utils fit together?

Vitest runs assertions, mocks, timers, and test files, while Vue Test Utils renders Vue components and exposes wrapper utilities. Together they cover component behavior and smaller unit logic. A good test still waits for Vue async DOM updates before asserting rendered changes.

Open Vue prep path →
Advanced

How do you test async Vue updates?

After changing reactive state or triggering DOM events, wait for Vue to flush updates with nextTick or helper utilities. For promises and network-like flows, flush pending promises before asserting final UI. Otherwise tests may pass or fail based on timing instead of behavior.

Review update timing →
Intermediate

How do you test Vue emitted events?

Mount the component, trigger the user action, and assert the emitted event name and payload. This verifies the child contract without requiring a parent component. For v-model components, assert the update event rather than mutating the prop in the child.

Review emits →
Advanced

Why is v-html a security risk?

v-html inserts raw HTML into the DOM, so untrusted content can create XSS if it is not sanitized before rendering. Interpolation escapes text by default, but v-html intentionally bypasses that escaping. Use it only for trusted or sanitized HTML and keep user-controlled input out of DOM sinks.

Review interpolation safety →
Advanced

How should rich text be rendered safely in Vue?

Sanitize rich text before it reaches v-html, restrict allowed tags and attributes, and avoid user-controlled URLs or scripts. Backend validation and a Content Security Policy reduce the impact of mistakes. Client-side rendering choices do not replace server-side trust boundaries.

Review DOM safety →
Advanced

How do you profile Vue performance?

Start with browser performance tools and Vue Devtools to identify expensive components, renders, and data changes. Then reduce unnecessary reactive dependencies, expensive template methods, unstable keys, and oversized lists. Optimization should follow measurement instead of guessing.

Review rendering costs →
Advanced

How do Vue components leak memory?

Leaks usually come from timers, event listeners, subscriptions, observers, or async callbacks that outlive the component. Cleanup belongs in the lifecycle owner that created the resource. Watchers and effects should also have clear invalidation or teardown behavior when they create external work.

Review cleanup hooks →

Most crucial Vue coding interview questions

Ranked by interview importance so you can start with the highest-signal implementation drills.

View full coding list

Need more implementation reps? Open the full coding list or follow a study plan.

Most crucial Vue concept questions for interviews

Ranked by interview importance to strengthen your explanation speed where it matters most.

View full concepts list

Need more concept coverage? Open the full concepts list or browse company packs.

Interview prep context

What Vue.js interview rounds test

Vue.js interviews test reactivity, rendering, component contracts, router/state decisions, and the ability to explain subtle lifecycle behavior. Use this Vue JS interview questions hub to rehearse that reasoning with practical prompts.

Editorial policy

What this round tests

  • Reactivity, refs, computed values, watchers, nextTick, and render timing.
  • Component communication, props/emits, v-model, provide/inject, and store boundaries.
  • Practical debugging around key stability, state resets, and visibility toggles.

How to use these questions

  • Start with one Vue coding prompt, then rehearse one concept explanation.
  • Use related concept questions to find weak reactivity or lifecycle assumptions.
  • Follow the Vue prep path when the same rendering or state miss repeats.

Vue prompts are grouped by FrontendAtlas importance signals and reviewed for framework-specific interview traps.

Quick answers

Common questions before you start

Are these Vue.js interview questions for beginners and experienced developers?

Yes. The page starts with Vue fundamentals, then moves into experienced-developer topics such as reactivity traps, Composition API design, Router, Pinia/Vuex, scenarios, testing, security, and performance.

Does this page cover Vue 3 and Composition API interview questions?

Yes. It covers Vue 3 reactivity, ref, reactive, computed values, watch, watchEffect, script setup, composables, Composition API trade-offs, Router, Pinia/Vuex, Teleport, Suspense, SSR, and Nuxt-style concerns.

Does this page include Vue reactivity interview questions like ref vs reactive and computed vs watch?

Yes. The reactivity sections cover ref, reactive, computed values, methods, watch, watchEffect, nextTick, dependency tracking, destructuring traps, virtual DOM diffing, and update batching.

Does this page include Vue scenario and code interview questions?

Yes. The scenario section covers destructuring that breaks reactivity, watcher loops, unstable v-for keys, prop mutation, nextTick timing, v-if lifecycle resets, computed side effects, and stale async search results.

Does this page include Vue testing, security, and performance interview questions?

Yes. It covers Vue Test Utils, Vitest, async DOM assertions, emitted events, v-html XSS risk, safe rich text, profiling, update dependencies, and cleanup for timers, listeners, and external subscriptions.

Where should I practice Vue.js coding interview questions?

Start with the Vue coding preview on this page, then move into debounced search, autocomplete, tabs, shopping cart, and the Vue prep path when you need a structured practice sequence.

Keep the scope tight

Start with one route first. Then expand into Question Library, Study Plans, and Company Prep only when you need them.

Recommended preparation

Recommended Vue interview preparation

Start with the interview preparation guide and shared baseline, then tighten Vue coding, concepts, and follow-up depth.

  1. Frontend interview preparation guideStart hereLearn the interview stages and scoring signals before narrowing into this technology.Process, rounds, and plan
  2. FrontendAtlas Essential 60Start with the shared shortlist to stabilize interview fundamentals before framework-specific depth.Shared frontend baseline
  3. Vue coding + concept questionsPractice Vue implementation prompts and explanation follow-ups from one filtered library view.Coding execution + concept recall
  4. Vue interview prep pathA focused path for reactivity, rendering, state, and component contracts.Framework-specific sequencing
  5. Final-round coverageAdd system design, behavioral, and company-style follow-ups after the framework baseline is stable.System design, behavioral, company rounds