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 What are composables, and why did they replace mixins?

    Composables are functions that use the Composition API to encapsulate and reuse stateful logic, such as useFetch, useMouse or usePagination. They return refs and functions explicitly. Mixins merged…

  2. Most asked What security risks should Vue developers watch for?

    Vue escapes text interpolation ({{ }}) and attribute bindings, so the main XSS risks are what bypasses that: v-html with untrusted content, user-controlled URLs in href/src (javascript: URLs),…

  3. Most asked What are template refs, and why do you need nextTick?

    A template ref gives direct access to a DOM element or child component instance (ref="input" plus const input = ref(null), or useTemplateRef('input') in 3.5+), available after mount. nextTick()…

  4. Most asked What are the main breaking changes when migrating from Vue 2 to Vue 3?

    The app is created with createApp() instead of new Vue(); global APIs moved to the app instance; v-model on components uses modelValue/update:modelValue (and .sync was removed); filters, $on/$off…

  5. What does <script setup> give you?

    <script setup> is compile-time syntax for using the Composition API in single-file components: top-level bindings (variables, functions, imports) are automatically available in the template, with…

  6. What is Vue.js, and what does 'progressive framework' mean?

    Vue is a JavaScript framework for building user interfaces with declarative, component-based templates and a fine-grained reactivity system. 'Progressive' means you can adopt it incrementally: from…

  7. What are shallowRef, shallowReactive and markRaw for?

    They limit reactivity: shallowRef tracks only replacement of .value, not changes inside it; shallowReactive tracks only top-level properties; markRaw marks an object so Vue never makes it reactive.…

  8. What router history modes exist, and what server configuration does each need?

    createWebHistory() uses normal URLs (/users/42) via the History API and needs the server to return index.html for unknown paths; createWebHashHistory() uses #/users/42, which needs no server…

  9. What are async components and Suspense?

    defineAsyncComponent(() => import('./Chart.vue')) loads a component only when it is rendered, with optional loading and error components. <Suspense> lets a tree with async dependencies (async setup…

  10. What is Teleport used for?

    <Teleport to="body"> renders part of a component's template somewhere else in the DOM while keeping it logically part of the component (props, events and state still work). It is used for modals,…

  11. What does KeepAlive do?

    <KeepAlive> caches component instances when they are switched out (for example between tabs or routes), so their state and DOM are preserved and switching back is instant. Cached components get…

  12. What is a Vue plugin, and how do you write one?

    A plugin is an object with an install(app, options) method (or a function) that adds app-level functionality: registering components or directives, providing values with app.provide, adding global…

  13. What are the pitfalls of deep watchers?

    A deep watcher (watch(source, cb, { deep: true }), or watching a reactive object directly, which is deep by default) traverses every nested property to track it, which is expensive for large…

  14. What event modifiers does Vue provide?

    Modifiers such as .prevent (preventDefault), .stop (stopPropagation), .self, .once, .capture and .passive, plus key modifiers (@keyup.enter, .esc) and system modifiers (.ctrl, .exact), handle common…

  15. What is a writable computed, and when is it useful?

    A computed with both get and set: reading derives a value, and assigning calls the setter, which updates the underlying state. It is useful for adapting state to an input (for example two-way…

  16. What are fragments and attribute fallthrough in Vue 3?

    Vue 3 components can have multiple root nodes (fragments). Attributes and listeners not declared as props or emits (class, id, @click, aria-*) fall through to a single root automatically; with…

  17. What role does Vite play in Vue development?

    Vite is the default build tool for Vue (npm create vue@latest): a fast development server using native ES modules with instant hot module replacement, and an optimised Rollup-based production build.…

  18. What does defineExpose do?

    In <script setup>, a component's internals are private: a parent using a template ref sees nothing. defineExpose({ focus, reset }) makes selected methods or state available to the parent through the…

  19. What does the `.value` unwrapping rule look like in templates, reactive objects and arrays?

    Top-level refs are unwrapped automatically in templates ({{ count }}), and refs nested as properties of a reactive() object are unwrapped when accessed (state.count instead of state.count.value).…

  20. What are Vue's official style-guide rules you consider essential?

    Multi-word component names (to avoid clashing with HTML elements), detailed prop definitions, keyed v-for, no v-if with v-for on the same element, and component-scoped styling. Strongly recommended:…

  21. What does v-memo do, and when would you use v-once?

    v-once renders an element or component once and treats it as static afterwards. v-memo="[dep1, dep2]" skips re-rendering a subtree unless one of the listed values changed; it is a micro-optimisation…

Was this page helpful?

Report a mistake