Vue’s distinctive behavior is not that it magically redraws a web page whenever something changes. Its rendering model depends on reactive dependency tracking: a component reads reactive values, Vue records those relationships, and changes to relevant dependencies schedule work to update the rendered output. Understanding that process helps diagnose stale interfaces, surprising recomputations, excessive watchers and state that appears to change without updating the DOM.
The discussion below concerns Vue 3’s current reactivity and component model. Older descriptions of Vue as a strict Model–View–ViewModel framework can be useful analogies, but they are not a precise account of how the current runtime performs dependency tracking and updates. Similarly, Vuex appears in older courses; the Vue team now recommends Pinia for new shared-state applications while Vuex remains in maintenance mode. Treat the runtime and state library as related, not interchangeable, parts of an application.
Reactive reads create dependencies; raw objects do not
When a component renders, it accesses reactive values used in the template. Vue can then schedule an update when those values change. A ref wraps a value and exposes .value in JavaScript; a reactive object uses a JavaScript Proxy to intercept supported property access and mutation. Templates unwrap refs for convenient display. Both APIs can make state observable, but they have different ergonomics and limitations.
A reactive proxy is not identical to the original object supplied to it. Modifying the raw object directly can bypass the proxy’s dependency-triggering behavior. Vue’s official guidance therefore recommends consistently using the proxied value. A ref is often the simpler default because it can hold primitives and can be replaced as a whole. A reactive object is useful for a group of properties but replacing its entire binding can disconnect consumers that track the original proxy.
import { ref, reactive } from 'vue'
const status = ref('idle')
const stats = reactive({ successes: 0, failures: 0 })
status.value = 'running'
stats.successes += 1
This code is illustrative module-level JavaScript; in a Vue single-file component it would typically appear inside <script setup>. status.value is the tracked ref value. stats.successes is read and written through the proxy. A component using either state source can respond when it has read the relevant dependency during rendering. A component that never reads stats.failures may not need a render update for that property alone. The important idea is dependency-sensitive updating, not the vague rule that every state change refreshes everything.
Computed properties cache derived meaning
A computed property describes a value derived from other reactive values. Vue tracks dependencies during its getter, caches the result and invalidates it when a dependency changes. That makes computed properties appropriate for search filtering, price totals, validation summaries or other pure calculations. They should not be used as an event system to trigger network calls, mutate unrelated state or log sensitive information on every access.
import { ref, computed } from 'vue'
const prices = ref([10, 20, 5])
const subtotal = computed(() =>
prices.value.reduce((sum, price) => sum + price, 0)
)
Here subtotal.value is initially 35. Updating the array through its reactive reference causes a later read of the computed value to reflect the new sum. The getter’s job is to calculate a result. If the component needs to write the total to a server, that belongs in an explicit action, effect or controlled synchronization flow. Mixing a side effect into the getter makes the app harder to reason about because merely reading a display value can cause work elsewhere.
An important distinction is between a computed value and an ordinary method called by rendering. Both can produce identical output, but the computed value can reuse its cached result until its tracked dependencies invalidate it. The difference matters for expensive derivations, not for turning every one-line expression into an additional abstraction. Overusing computed properties can obscure simple state flow just as underusing them can duplicate transformations across components.
Watchers coordinate side effects, not basic display math
A watcher observes one or more reactive sources and runs a callback when they change. This is useful when an external system, asynchronous request or imperative API must respond to state. For example, a search query may trigger a remote request. That workflow also needs loading state, cancellation, errors and a strategy for ignoring stale responses. A watcher by itself does not guarantee that requests finish in the order they started.
The distinction between watch and watchEffect matters. With watch, the developer identifies the source to observe and receives old and new values as appropriate. With watchEffect, dependencies used during the effect’s synchronous execution are tracked automatically. Neither should be used to create a feedback loop that repeatedly changes its own inputs. For UI state that can be calculated without side effects, prefer computed first.
A common failure is to start a request for an earlier query and let its slower response overwrite a newer result. The remedy may be cancellation through a supported AbortController, cleanup logic or a request sequence identifier. The implementation depends on the transport and framework integration. This is a real engineering problem, not a performance issue solved by turning a field into a reactive variable. Vue supplies the reactive lifecycle; the application must still define which response is authoritative.
Render updates are scheduled rather than applied immediately
Vue buffers DOM updates so multiple state changes in one synchronous turn can be batched. Changing a ref does not require the DOM to already reflect the new value on the next line of JavaScript. When code must read the updated DOM after a state change, Vue exposes nextTick to await the relevant flush. This distinction prevents tests and integrations from reading stale element text and misdiagnosing it as a failed reactive assignment.
import { ref, nextTick } from 'vue'
const count = ref(0)
async function incrementAndObserve() {
count.value += 1
await nextTick()
// A template bound to count can now reflect the queued update.
}
nextTick is not a network synchronization primitive. It does not wait for a backend response, a CSS transition to finish or an external library to complete unrelated work. It waits for Vue’s queued DOM update. A test that requires both a remote request and a render update must separately wait for the relevant async operation and the component’s rendering behavior. This helps keep test assertions aligned with actual system boundaries.
Large component trees can also create more updates than a simple example suggests. Diagnose with Vue DevTools and profiling rather than adding watchers or memoization blindly. Component props, computed dependencies and list keys can explain why a child rerenders. Performance improvements should be tied to a reproducible slow path and measured before and after the change.
Component boundaries determine data ownership
Vue encourages components to receive values as props and communicate events upward. This one-way flow makes ownership easier to inspect: a parent owns a record, and a child renders or requests a change without mutating the parent’s state arbitrarily. Two-way form binding is convenient inside a component, but a custom component still needs a documented model contract rather than relying on a global mutable object to synchronize everything.
Global state becomes useful when separate parts of an application need the same records or actions. The current Vue guidance recommends Pinia for new applications, partly because it provides conventions, developer tooling and better TypeScript integration. A store does not remove the need for ownership, access control or a backend persistence strategy. It merely coordinates client-side state. Server-derived data can become stale, and an optimistic UI update must be reconciled with an authoritative server response.
For a small form or single widget, local refs and props are simpler and often more reliable. Introducing a store for every local boolean can increase coupling. Conversely, passing a deeply shared session object through many intermediary components may make changes harder to reason about. The right boundary is determined by where state is created, who can change it and how inconsistencies are resolved.
Rendering, accessibility and error handling require separate checks
Reactivity can keep visible text current, but it does not automatically make an interface accessible. A form still needs labels, keyboard behavior, focus handling and understandable error feedback. A list filtered by computed state should use stable keys and tell users when no results remain. A component loading remote data needs a meaningful loading or error state. These are design obligations built on top of the reactivity system.
Likewise, escaping data during template rendering does not grant permission to inject arbitrary HTML. v-html renders HTML and should not be fed untrusted input without a sound sanitization design. A reactive object carrying personal data should not be logged casually in developer tools or error telemetry. Test privacy controls and output handling where data enters the application, not after it has been propagated through components.
A useful diagnostic exercise is to reproduce a stale display with a raw object, correct it by using the proxy, then introduce a computed display and a watcher with a deliberately slow async response. Explain which behavior Vue manages and which behavior the application must manage. Once those boundaries are clear, the framework becomes less mysterious: tracked state drives rendering, derived values represent pure calculations, watchers connect to effects, and components establish explicit ownership.