Vue.js interview questions and answers, from reactivity to Pinia

Vue.js interview questions test whether you understand the reactivity system behind the templates: when a ref or a reactive object triggers an update, why computed values cache, and which watcher fits a side effect. Mid-level and senior rounds add component communication with props, emits, v-model and slots, state in Pinia, routing guards, and how a Vue 2 codebase moves to Vue 3. A good Vue developer answer explains what the framework tracks, not only which directive to type.

By Published 10 min read

How Vue.js shows up in interviews

Vue questions come up in front-end and full-stack interviews at companies that picked Vue for their product, at agencies, and in teams that still run a Vue 2 app and want someone to finish the move to Vue 3. The screen is usually a set of concept questions. The technical round is often a small live build: a searchable list, a form with validation, or a component that fetches data and handles loading and error states. Senior candidates get a design conversation about state, routing and how the app is split into components.

  1. Recruiter or engineer screenShort concept checks: directives, the difference between computed and methods, how props and events flow, which Vue version you used.
  2. Live coding or take-homeBuild a component or a small feature in a Vite project, often with a fetch call, a list with keys and a form. Reviewers read your component boundaries as closely as the output.
  3. Deep diveReactivity internals, performance on big lists, Pinia store design, router guards, testing with Vitest and Vue Test Utils, and server rendering with Nuxt.
  4. BehavioralA migration you led, a performance problem you found, and how you handled a disagreement about architecture.

Fundamentals: templates, directives and the instance

Vue basics most screens ask
QuestionWhat it testsWhat a strong answer shows
What is the difference between v-if and v-show?Rendering costv-if adds and removes the element and its component tree; v-show keeps it and toggles CSS display. Use v-show for things that flip often, v-if for things that rarely appear.
Why does v-for need a key?List patchingThe key lets Vue match old and new nodes, so it moves elements instead of reusing the wrong one. Array indexes break when items are inserted, removed or sorted, and local state ends up on the wrong row.
Can you put v-if and v-for on the same element?Directive precedenceIn Vue 3, v-if is evaluated first, so it cannot see the loop variable. Vue 2 did the opposite. Either way the fix is a computed filtered list or a wrapping template tag.
What is the difference between computed properties and methods?CachingA computed value is cached until one of its reactive dependencies changes. A method runs on every render. Expensive derived data belongs in computed.
What does v-bind do, and what is the shorthand?Template syntaxIt binds an attribute or prop to an expression; the shorthand is a colon. Binding an object spreads its keys as attributes.
How does v-on work with modifiers?EventsThe @ shorthand attaches a listener. Modifiers such as .prevent, .stop, .once and key modifiers such as .enter keep DOM details out of the handler.
What is the virtual DOM, and what does the Vue compiler add?Rendering modelTemplates compile to render functions that produce virtual nodes. The Vue 3 compiler marks static parts and patch flags, so diffing skips nodes that cannot change.
What is a single-file component?ToolingA .vue file with template, script and style blocks, compiled by a build tool such as Vite. Scoped styles add an attribute so rules apply only to that component.
Vue basics most screens ask. Scroll sideways on a small screen.

Reactivity: ref, reactive, computed and watchers

Most Vue rounds spend real time here, because reactivity bugs are the ones that ship. Vue 3 builds reactivity on JavaScript Proxy objects. When an effect (a render, a computed, a watcher) reads a reactive property, Vue records the dependency. When that property is written, Vue schedules the effects that read it. Vue 2 used getters and setters instead, which is why it could not see properties added later and needed Vue.set.

  • When do you use ref and when reactive? ref works for any value, primitives included, and you read it through .value in script; templates unwrap it. reactive only takes objects and returns a proxy. Many teams default to ref everywhere for consistency, because a reactive object cannot be reassigned as a whole without losing the link.
  • Why did my component stop updating after I destructured state? Destructuring a reactive object copies plain values out of the proxy. Use toRefs to get refs that stay connected, or keep the object and read state.count directly.
  • What is the difference between watch and watchEffect? watch names its source and gives you old and new values, and it is lazy by default. watchEffect runs immediately and tracks whatever it reads. Use watch when you need the previous value or want to control exactly what triggers it.
  • How do you watch a nested object? Pass a getter for the specific field you care about, or use deep: true on the object. Deep watching a large structure costs time on every change, so a narrow getter is usually better.
  • What does nextTick do? Vue batches DOM updates and applies them asynchronously. Awaiting nextTick waits until the DOM reflects your state change, which you need before measuring an element.
  • When would you use shallowRef or markRaw? For large objects you replace as a whole, or third-party instances such as a chart or map, so Vue does not wrap every nested property in a proxy.
  • Can a computed property have side effects? It should not. A computed getter may run at unpredictable times or not at all if nobody reads it. Fetching and saving belong in watchers or event handlers.
import { ref, watch, onScopeDispose } from "vue";

export function useUser(userId) {
  const user = ref(null);
  const error = ref(null);
  const loading = ref(false);
  let controller = null;

  watch(
    userId,
    async (id) => {
      controller?.abort();
      const current = new AbortController();
      controller = current;
      loading.value = true;
      error.value = null;
      try {
        const res = await fetch("/api/users/" + id, { signal: current.signal });
        if (!res.ok) throw new Error("HTTP " + res.status);
        const data = await res.json();
        if (controller === current) user.value = data;
      } catch (e) {
        if (e.name !== "AbortError") error.value = e;
      } finally {
        // An aborted older call must not switch off the newer call's spinner.
        if (controller === current) loading.value = false;
      }
    },
    { immediate: true }
  );

  onScopeDispose(() => controller?.abort());
  return { user, error, loading };
}
A composable that fetches whenever the id changes, cancels the stale request and only lets the latest call update state. Vue is not installed here; the logic was run in node with a stubbed ref and watch and a fake abortable fetch.

Interviewers like this pattern because it touches three things at once: a watcher with immediate: true, a race between two requests, and cleanup when the component unmounts. If you are asked to write it live, say out loud why the abort and the controller check are there. Without them, a slow first response can overwrite the result of a faster second one, or an aborted call can clear the loading flag while the newer request is still in flight.

Components: props, emits, v-model, slots and provide/inject

Component communication questions
QuestionWhat it testsWhat a strong answer shows
Why should a child not change a prop?One-way data flowThe parent owns the value and will overwrite the child's change on its next render. The child emits an event, or copies the prop into local state when it only needs a starting value.
How does v-model work on a custom component?Two-way bindingIn Vue 3 it passes a modelValue prop and listens for update:modelValue. You can name several models. Recent 3.x releases add a defineModel macro that writes this pair for you.
What are scoped slots used for?Reusable layoutThe child renders data it owns and lets the parent decide the markup, as in a table that hands each row to the parent's template.
When is provide and inject a better fit than props?Deep treesWhen many levels need the same value, such as a theme or a form context. It hides the dependency, so keep it for shared context, not for normal data flow.
How do you type props and emits?TypeScriptWith defineProps and defineEmits using type arguments in script setup. Defaults come from withDefaults or, in newer versions, destructuring with defaults.
What do defineExpose and template refs do?Imperative accessA template ref gives the parent the child instance, and defineExpose decides what it may touch, such as a focus() method. Use it rarely.
What are Teleport and KeepAlive for?Built-in componentsTeleport renders a modal or tooltip elsewhere in the DOM while it stays in the component tree. KeepAlive caches inactive components, such as tabs, with their state.
How do you load a heavy component only when needed?Code splittingdefineAsyncComponent with a dynamic import, or a lazy route component, so the bundle for that screen loads on demand.
Component communication questions. Scroll sideways on a small screen.

Composition API, Options API and lifecycle

  • Why was the Composition API added? Logic for one feature was spread across data, methods, computed and watch in the Options API. The Composition API groups it by concern and lets you extract it into composables, which replace mixins and their name clashes.
  • Is the Options API deprecated? No. Both are supported in Vue 3. Say which you used and why, and that script setup is the common default for new code.
  • What runs in setup, and what is not available yet? setup runs before the component mounts, so the DOM is not there. Use onMounted for anything that needs elements.
  • Which lifecycle hook would you use to remove a window listener? onUnmounted or onBeforeUnmount. Missing cleanup is a classic memory leak in single-page apps.
  • What makes a good composable? A function named useSomething that creates its own refs, takes refs or getters as input, cleans up after itself and returns refs, so callers can destructure safely.
  • How do mixins compare with composables? Mixins merge into the component silently, so the source of a property is unclear and names collide. Composables are explicit imports with explicit return values.

State, routing and server rendering

App-level questions for mid-level and senior Vue developers
QuestionWhat it testsWhat a strong answer shows
Pinia or Vuex, and why?State managementPinia is the officially recommended store for Vue 3: simpler API, no mutations, good TypeScript inference and devtools support. Vuex remains in older apps.
What belongs in a global store?State designData many distant screens read, such as the signed-in user or a cart. Form drafts and UI toggles stay local. Server data often fits a fetching layer with caching better than a hand-written store.
How do you protect routes that need login?Vue RouterA global beforeEach guard that checks auth and returns a redirect location. Route meta fields mark which routes need it. The server must still check every request.
How do you lazy-load routes?Bundle sizeUse a dynamic import as the route component so each page becomes its own chunk.
What does Nuxt add on top of Vue?SSR and structureFile-based routing, server rendering and static generation, data fetching helpers and server routes. It suits pages that need SEO or a fast first paint.
What causes a hydration mismatch?SSR correctnessThe server HTML differs from the first client render, often because of dates, random values or browser-only APIs read during render. Move those reads to onMounted or make them deterministic.
App-level questions for mid-level and senior Vue developers. Scroll sideways on a small screen.

Senior and scenario questions

  • A list of 10,000 rows scrolls badly. What do you check? Whether every row is a heavy component, whether keys are stable, and whether large data is deeply reactive. Fixes: virtual scrolling, shallowRef for the data, v-memo or v-once for rows that rarely change, and pagination where the product allows.
  • How would you migrate a large Vue 2 app to Vue 3? Vue 2 reached end of life at the end of 2023, so this is common work. Inventory breaking changes (filters removed, v-model changes, the global API), upgrade dependencies first, consider the migration build for a gradual path, and move one area at a time with tests around it.
  • A watcher fires in a loop and freezes the page. Why? It writes to a value it also watches, directly or through a chain. Compare before writing, or move the derived value into computed.
  • How do you test a component that calls an API? Mount it with Vue Test Utils in Vitest, mock the fetch layer, await flushPromises, and assert on rendered output and emitted events rather than internal state.
  • How do you handle errors across the app? app.config.errorHandler for uncaught errors, onErrorCaptured for a section boundary, and explicit error state for each request the user can retry.
  • When would you pick Vue over React for a new project, or the other way? Talk about team skills, hiring, ecosystem needs and the app's shape rather than benchmarks. Vue gives an official router and store; React leaves more choices to you.
  • How do you share UI components across several Vue apps? A component library package with its own build, typed props, documented slots, peer dependency on Vue, and visual tests. Version it so apps can upgrade on their own schedule.

Fictional example

Answering "Our search box sends a request on every keystroke and sometimes shows old results. Fix it."
Interviewer
Here is the component. It watches the query ref and calls the search API. Users see results for an earlier query flash in after the right ones.
Candidate
Two problems. First, every keystroke fires a request, so I would debounce the query, say 250 milliseconds, with a small composable that writes to a second ref after a pause. Second, responses arrive out of order: the request for 'vu' can finish after the one for 'vue' and overwrite it. I would abort the previous request with an AbortController inside the watcher, or keep a counter and ignore any response that is not the latest. I would also skip the call when the trimmed query is shorter than two characters and clear the results. Then a test: mount the component with a mocked fetch that resolves the first call late, type two queries, flush promises, and assert that only the second set of results renders.

Ten-day Vue.js practice plan

  • Days 1 and 2: build a small app with script setup, a few components, props and emits. Explain each data flow out loud.
  • Days 3 and 4: break reactivity on purpose: destructure a reactive object, replace a reactive object, mutate a prop. Note each warning or silent failure and the fix.
  • Days 5 and 6: write three composables (fetching, debouncing, local storage sync) with cleanup, and test them with Vitest.
  • Day 7: add Pinia and Vue Router with a login guard and a lazy route, and explain what you kept local.
  • Day 8: render a long list, measure it with the browser profiler, then fix it.
  • Days 9 and 10: do two timed builds of 45 minutes each and review where you lost time.

Vue answers often get compared with other frameworks. For the React side of that discussion, read React interview questions; for a framework with its own change detection and dependency injection, see Angular interview questions. If the role is full-stack with a Node back end, Express.js interview questions cover the server half, and FastAPI interview questions cover a Python API behind a Vue front end. Broader front-end rounds are in frontend developer interview questions.

Practice the live build with a recording you can read back. Natively, an AI interview assistant for Mac and Windows, transcribes your mock round on your computer, so afterwards you can check whether you explained the reactivity choice or just typed it. During practice it can read a component task from a screenshot and suggest an approach or code, and with Pro or the free trial it uses the résumé and job description you add. Transcripts and notes stay available for review.

Questions people ask

What Vue.js questions are asked in interviews?

Expect directives and list keys, ref versus reactive, computed versus watch, props and emitted events, v-model on components, slots, the Composition API, Pinia, Vue Router guards, and for senior roles performance and the Vue 2 to Vue 3 migration.

What is the difference between ref and reactive in Vue 3?

ref holds any value, including primitives, and is read through .value in script. reactive only accepts objects and returns a proxy; destructuring it or replacing it as a whole breaks reactivity unless you use toRefs.

What is the difference between computed and watch in Vue?

computed derives a cached value from reactive state and should have no side effects. watch runs a callback when a named source changes, which suits fetching data, saving drafts or other side effects.

How should a Vue developer prepare for a live coding round?

Build small features under a timer in a Vite project: a fetched list with loading and error states, a validated form and a component with v-model. Explain each data flow out loud while you type.

Where to go next

Practice with the same assistant you would use on a call: it listens, transcribes and suggests answers from your own resume and the job description.

Facts on this page were last checked on . Product details come from the Natively app itself; if something here is out of date, tell us at hello@heynatively.com.

Keep reading

Put it on your own machine.

A live-conversation assistant that runs locally. Your conversations stay on your machine.

macOS 12+ · Windows 10/11

© 2026 Natively AI Private Limited

Source-available under the Natively Personal Use Source License v1.0 · IP geolocation by DB-IP