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.

  1. Most asked How do you use Vue Router: dynamic routes, nested routes and navigation guards?

    Routes map paths to components; dynamic segments (/users/:id) become route.params; nested routes render children inside a parent's <RouterView>; navigation guards (router.beforeEach, per-route…

  2. Most asked How do you optimise the performance of a Vue application?

    Measure first (Vue Devtools performance timeline, browser profiler, Lighthouse), then: reduce bundle size (lazy routes, tree-shaking, analysing dependencies), avoid unnecessary re-renders (stable…

  3. Most asked How do you test Vue components?

    Use Vitest with Vue Test Utils (or Testing Library for Vue) to mount components, interact with them as a user would, and assert on rendered output and emitted events; test composables and stores as…

  4. How do you fetch data in Vue components robustly?

    Track loading, error and data states; cancel or ignore stale requests when inputs change (AbortController with a watcher cleanup); cache and deduplicate where useful; and centralise the pattern in a…

  5. How do you use a Pinia store correctly in components, and what is storeToRefs for?

    Call useXStore() inside setup; read state, getters and actions from it. Destructuring the store directly breaks reactivity for state and getters, so use storeToRefs(store) for them; actions can be…

  6. How do you lazy-load routes and code-split a Vue application?

    Use dynamic imports for route components (component: () => import('./views/Reports.vue')), so each route is a separate chunk loaded on demand; defineAsyncComponent does the same for heavy components…

  7. What causes hydration mismatches, and how do you fix them?

    A hydration mismatch happens when the HTML rendered on the client during hydration differs from the server HTML: dates and random values, browser-only data (window width, localStorage), locale or…

  8. How do you make a Vue single-page application SEO-friendly?

    Serve real HTML for content pages: server-side render or pre-render them (Nuxt, or a static generation step), give every route a unique title and meta description (useHead from Unhead in Nuxt), use…

  9. How do you use TypeScript with Vue?

    Use <script setup lang="ts">, type props and emits with type-based declarations (defineProps<{ id: number; label?: string }>()), type refs where inference is not enough (ref<User | null>(null)), use…

Was this page helpful?

Report a mistake