Reactivity, components, Composition API, Vue 3.5 features, and the Vue interview essentials.
Preview — first 3 of 120 cards
ref vs reactive?
Both create reactive state. ref wraps any value in an object with a .value property; reactive returns a deep proxy for objects and collections only. The official docs recommend ref as the primary API: a reactive object loses reactivity when destructured or reassigned (state = {...}), while a ref can be reassigned and passed around safely. Use reactive mainly for grouped state that is always accessed through the same object.
const count = ref(0);
const state = reactive({ name: 'Ada' });
state.name = 'Grace'; // tracked
count.value++; // tracked
// let s = state;
// s = { name: 'x' }; // reassignment loses the original proxy
Why .value for ref?
A ref is a plain object with a getter/setter on value, which lets Vue track reads and writes even for primitives that cannot be proxied. In templates, top-level refs are auto-unwrapped; in script you must use .value. Refs also unwrap automatically when nested inside a reactive object.
const count = ref(0);
count.value++;
console.log(count.value); // 1
const state = reactive({ count });
state.count++; // no .value here
computed properties?
Cached derived state. The getter re-runs only when a tracked dependency changes, and the result is cached between reads. Pass { get, set } for a writable computed. Computed getters must be synchronous and free of side effects.
const first = ref('Ada');
const last = ref('Lovelace');
const full = computed(() => `${first.value} ${last.value}`);
const writable = computed({
get: () => first.value,
set: (v) => (first.value = v),
});
117 more cards in this sheet
Unlock the Frontend & Mobile bundle — ₹399
One-time payment. Unlocks this sheet and 8 other sheets in the bundle, plus a typeset PDF of each.
Unlock the bundle
See all bundles
Or get all 76 sheets for ₹999 — one payment, every future sheet included.