Skip to content
tezvyn:

Reactivity

38 bites tagged Reactivity — interview questions with model answers, and 60-second explainers.

Vue, Angular & Svelte2 min read

How do Vue, Angular, and Svelte stores trigger component re-renders?

Tests deep knowledge of reactivity primitives. Contrast Vue's proxy subscriptions, Angular's RxJS push through async pipe or markForCheck, and Svelte's compiler-generated store invalidation. Red flag: claiming all three use virtual DOM diffing or polling.

Vue, Angular & Svelte2 min read

How would you implement a memoized selector for expensive derived state?

It tests cache invalidation and pure functions for reactive derived state. A strong answer covers reference tracking on inputs, returning cached results when unchanged, and requiring immutable or stable arguments.

Vue, Angular & Svelte2 min read

How do Vue, Angular, and Svelte handle deep prop mutation re-rendering?

Vue and Svelte detect nested mutations via Proxies; Angular default re-renders via Zone.js, but ngOnChanges misses it since the reference is unchanged. Deep reactivity vs zone-driven dirty checking.

Vue, Angular & Svelte2 min read

How does Angular's Zone.js change detection differ from Vue and Svelte reactivity?

Tests granular reactivity architecture. Angular Zone.js monkey-patches async to scan the full component tree; Vue uses runtime Proxy tracking; Svelte compiles runes into targeted DOM bindings.

Vue, Angular & Svelte2 min read

How does Svelte compile count += 1 into DOM updates?

Tests if you know Svelte reactivity is compile-time via runes, not runtime proxies. Good answer: $state marks reactive vars; runes are compiler hooks; compiler emits DOM-sync code. Red flag: describing useState or VDOM.

Vue, Angular & Svelte2 min read

Compare Angular Zone.js and Vue 3 Proxy reactivity

This tests update granularity. Contrast Vue 3 Proxy tracking, targeting only affected components, with Angular Zone.js patching async APIs to trigger top-down dirty checking across tree. Vue binds deps at render; Angular compares values each cycle.

Vue, Angular & Svelte2 min read

What is the Virtual DOM's role during a Vue state update?

Tests your grasp of Vue's reactive render pipeline. A strong answer: state change triggers a new virtual DOM tree; runtime diffs it against the old tree to apply only necessary real DOM updates. Red flag: saying virtual DOM updates browser DOM directly.

Vue, Angular & Svelte2 min read

How do you architect Svelte stores to minimize WebSocket re-renders?

Tests Svelte store granularity and subscription semantics. A great answer splits the monolith into domain stores, uses derived selectors to isolate slices, and leverages readable stores to encapsulate the WebSocket source.

Vue, Angular & Svelte2 min read

How does Svelte surgically update the DOM without VDOM?

Tests VDOM overhead vs compile-time optimization. A strong answer explains that Svelte compiles reactive dependencies into direct DOM API calls, skipping tree creation and diffing. Red flag: claiming VDOM is slow because the DOM itself is slow.

Vue, Angular & Svelte2 min read

Vue computed vs method: performance difference and when to choose each?

This tests Vue reactivity caching. Answer: computed caches and reruns only when reactive deps change, while methods run each render. Choose computed for derived data; methods for events/args. Red flag: saying computed is always faster or passing arguments.

Vue, Angular & Svelte2 min read

How would you design useCounter to support shared or independent state?

Tests your grasp of scope in Vue composables. Great answers contrast module-level refs for global singleton state against function-level refs for per-instance isolation, and explain tradeoffs.

Vue, Angular & Svelte2 min read

How do you implement a data-fetching Composable in Vue 3?

Write useFetch accepting a URL, exposing data, loading, and error refs, then return them. grasp of stateful logic reuse via Vue's Composition API. returning plain vars or using shared singletons instead of factories.

Vue, Angular & Svelte2 min read

Build a reactive data-fetching utility with Svelte stores

Tests store composition for async data fetching with caching and auto re-fetch. Strong answer: readable for lifecycle, derived's set callback for race-safe fetches, writable for private inputs. Red flag: exposed internals or missing cleanup.

Vue, Angular & Svelte2 min read

How do you structure components and state for a dynamic Vue form?

This tests your design of normalized reactive state for dynamic Vue forms. A great answer uses a flat item array with stable keys, row components or scoped slots, and schema-driven validation. Red flags include mutating by index or using array indices as keys.

Vue, Angular & Svelte2 min read

Validate matching Vue passwords: computed property or watcher?

Use a computed boolean for caching and dependency tracking; reserve watchers for side effects only. Whether you derive state or watch imperatively. Using a watcher to sync a match flag, wasting cycles and causing bugs.

Vue, Angular & Svelte2 min read

Bind an input to a variable and validate with reactivity

Tests Svelte reactivity: connecting DOM state to validation logic. Good answer: `$state` for the variable, `$effect` to run validation when it changes, cleanup if needed. Red flag: using effects where event handlers suffice or creating infinite loops.

Vue, Angular & Svelte2 min read

Implement auto-cleanup reactive logic in Vue's Composition API and Svelte

Vue pairs onMounted with onUnmounted or watchEffect cleanup; Svelte uses $store auto-subscription or onDestroy. Binding streams to lifecycles without leaks.

Vue, Angular & Svelte2 min read

How do Svelte Stores work and how do you create custom ones?

Tests Svelte store contract mastery. A strong answer defines the subscribe/unsubscribe interface, wraps writable() with custom set/update logic, subscribes via $ prefix or manually, and uses $store in templates.

Vue, Angular & Svelte2 min read

Fundamental difference between Vue computed and watcher with examples

Tests derived state vs side effects in Vue reactivity. Computed returns cached derived value; watch executes callback on mutation. Example: computed filters list; watch fetches data when ID changes. Red flag: watch for template state or computed for async.

Vue, Angular & Svelte2 min read

How do you update Svelte arrays and objects to trigger reactivity?

This tests knowledge of Svelte 5 deep reactivity: $state wraps arrays in proxies so push and property mutations trigger updates. Mention $state first, then note legacy syntax needs reassignment. A red flag is claiming push never works in Svelte.

Vue, Angular & Svelte2 min read

Vue 3 ref() vs reactive(): differences and when to use each

Tests Vue 3 Composition API reactivity primitives. Strong answer: ref() wraps any value in a .value wrapper and is the recommended default; reactive() returns a proxy accessed directly. Red flag: saying ref() is only for primitives or omitting .value entirely.

Vue, Angular & Svelte2 min read

Why does todos.push miss Svelte updates but spread works?

Tests compile-time versus runtime reactivity. Answer: Svelte's compiler instruments assignments, not method calls, so push is invisible; Vue Proxies and Angular Zone.js both intercept push to trigger updates.

Vue, Angular & Svelte2 min read

Explain two-way data binding and provide input binding syntax

Tests whether you see two-way binding as sugar for value binding plus an input event. Strong answer: show one syntax, then explain the prop-out, event-in pattern. Red flag: syntax only with no mention of change detection or unidirectional flow.

Vue, Angular & Svelte2 min read

How do Vue and Angular detect nested object mutations?

Tests deep reactivity vs reference-based detection. Vue 3 Proxies catch nested mutations; Angular Default checks on zone ticks and OnPush misses same-reference changes. Fix via immutability, deep watchers, or ngDoCheck.

Get Reactivity bites daily.

Five a day, five minutes, offline. With quizzes so it sticks.

Open testing — you’ll join as an early tester.