Both make data “live” so the page updates when it changes. ref wraps any value in a box you open with .value (templates open it automatically). reactive makes an object live directly, but you lose reactivity if you destructure it or replace the whole object.
const count = ref(0);
count.value++;
const state = reactive({ items: [] });
state.items.push('a'); // reactive
let { items } = state; // destructured: no longer reactive!
Say it like this in the interview
“ref works for primitives and objects and is accessed with .value. reactive uses a Proxy for objects but breaks on destructuring or reassignment. Many teams default to ref for consistency, and use toRefs when destructuring reactive objects.”
computed = a value derived from other values (full name from first + last), cached until inputs change. watch = do a side effect when something changes (call an API, save to storage).
Say it like this in the interview
“computed for derived values: it’s cached and declarative. watch or watchEffect for side effects like fetching or syncing to storage. If I’m setting state inside a watcher just to derive data, it should be a computed instead.”
Props flow down from the parent. If the child changes them, the parent’s next update overwrites the change, and data flow becomes confusing. The child should ask the parent to change it by emitting an event.
Say it like this in the interview
“One-way data flow: the parent owns the data. The child emits an event, or uses v-model with defineModel, and the parent updates its state. If the child needs a local editable copy, it copies the prop into its own ref.”
Moments in a component’s life where you can run code: created, added to the page (mounted), updated, and removed (unmounted).
Say it like this in the interview
“In the Composition API: onMounted for DOM access or fetching, onUpdated, onUnmounted for cleanup like timers and listeners; setup replaces created. In the Options API: created, mounted, updated, unmounted.”
It’s shorthand for passing a value down and listening for an update event. The child receives the value and emits when it changes.
Say it like this in the interview
“On components, v-model binds the modelValue prop and the update:modelValue event; Vue 3.4+ defineModel() simplifies it. Multiple v-models use arguments like v-model:title.”
Pinia is Vue’s official shared store: a single place for data many components need, like the logged-in user or the cart, with devtools support.
Say it like this in the interview
“Pinia is the official state library replacing Vuex: stores with state, getters and actions, fully typed, modular, with devtools and SSR support. I use it for cross-cutting client state; component-local state stays local, and server data can use a query library.”
A way for a parent to share data with deep children without passing props through every level.
Say it like this in the interview
“A parent provides a value and any descendant can inject it, Vue’s answer to prop drilling, similar to React Context. For app-wide state, Pinia is clearer.”
v-if adds/removes the element from the page entirely. v-show keeps it and just hides it with CSS. Toggling often → v-show. Rarely shown or expensive → v-if.
Say it like this in the interview
“v-if conditionally renders and destroys the element and its components; v-show toggles display. v-show has higher initial cost but cheap toggling.”
Nuxt is to Vue what Next.js is to React: routing from files, server-side rendering, data fetching and SEO built in.
Say it like this in the interview
“File-based routing, SSR and static generation, useFetch and useAsyncData, auto-imports, server routes with Nitro, and modules for SEO, images and auth.”