Framework Reactivity: Coarse vs. Fine-Grained Updates

Frameworks sync UI and state differently. Coarse-grained systems like React re-run component code, while fine-grained systems like Vue (Proxies) or Angular (Signals) track dependencies to update only what's needed.
Why it exists
All modern UI frameworks must solve one core problem: keeping the user interface synchronized with the application's state. When data changes, the screen must reflect it. Different frameworks evolved distinct strategies to manage this process efficiently, balancing developer experience with performance.
The mental model
Think of reactivity as a notification system. A coarse-grained system is like a building's fire alarm: it yells "something changed!" and everyone evacuates and re-assembles. This is like React re-rendering a component tree. A fine-grained system is like a pager: it sends a message directly to the specific people who need to act. This is like Vue updating only the exact DOM nodes that depend on a piece of state, skipping the rest of the component.
How it works
Frameworks use different tools to achieve these models. Coarse-grained (React) works by re-running the component function when state changes. It creates a new virtual DOM, compares ("diffs") it with the old one, and applies only the necessary changes to the real DOM. Fine-grained systems use more direct tracking. Vue 3 uses JavaScript Proxies to intercept state access; when you read a property, Vue records a dependency, and when you write to it, only its dependents are notified. Angular's Signals are explicit state containers that track their own subscribers, notifying them directly on change. Svelte acts as a compiler, analyzing your code at build time to generate optimized JavaScript that directly manipulates the DOM when state changes, a process made more explicit with Svelte 5's Runes.
When to use it
Coarse-grained reactivity, as in React, offers a simple mental model where the UI is always a function of state, supported by a massive ecosystem. The React Compiler now automates optimizations, mitigating historical performance concerns. Fine-grained reactivity, found in Vue, Angular Signals, and Svelte, is excellent for performance-critical applications. It offers surgical precision, ensuring the absolute minimum amount of code runs when state changes, which can lead to faster updates and less CPU usage.
When not to use it
The main risk is misunderstanding the model you're working with. Don't assume React's re-render model is inherently slow; its VDOM diffing is highly optimized. However, poor state management can cause performance bottlenecks. Conversely, don't assume fine-grained systems are a free lunch. Their dependency tracking mechanisms consume memory and CPU, and in systems like Vue, deeply nested reactive objects can introduce overhead.
One canonical example
A simple counter illustrates the difference. In React, calling setCount(1) triggers a re-render of the entire component function. In Vue, updating count.value (a Proxy-wrapped ref) only updates the specific DOM text node that displays it. In Angular, calling count.set(1) on a signal notifies only the specific components or computed values that read from it, bypassing the rest of the component tree.
Interview question
A framework updates a large part of the UI after a small state change. Which reactivity model is it likely using?
- a.Coarse-grained, as it re-runs component functions and diffs a new virtual DOM.Correct
- b.Fine-grained, as it prioritizes developer experience over granular updates.
- c.Fine-grained, due to overhead from deeply nested reactive objects.
- d.Coarse-grained, as it directly manipulates the real DOM without a virtual DOM.
Why? this is the answer
Coarse-grained systems like React re-run entire component functions and then compare a new virtual DOM, which can lead to a broader re-evaluation of the UI even for small state changes. While fine-grained systems can have overhead with deeply nested objects, their core mechanism aims for surgical precision, updating only the specific parts of the DOM that depend on the changed state.
Just read this? Test yourself on what you have been reading.
Read the original → blog.openreplay.com
You just looked this up. Could you explain it out loud?
That is the part interviews actually test. Tezvyn takes questions like this one and gives you what the interviewer is really checking, the answer that lands, and the mistake that ends the conversation, in the four minutes before your next meeting.
The iPhone app is on the way
We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.
Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.
We are hiring for this. Open roles that interview on react — each one lists the topics its interview covers.
See open roles