Virtual DOM
An in-memory representation of the UI that a framework diffs against the previous version to compute minimal real DOM updates.
Virtual DOM is an in-memory tree of plain JavaScript objects that mirrors what the real Document Object Model should look like. When state changes, the framework builds a new virtual tree, diffs it against the previous one, and applies only the resulting minimal set of changes to the real DOM — rather than the component author manually figuring out which elements need updating and writing imperative code to update just those.
The reason this exists at all is that real DOM operations are comparatively expensive — a browser recalculating layout and repainting costs far more than allocating and comparing plain objects in memory — so batching many logical changes into one minimal, computed set of real DOM writes is faster in the aggregate than applying each change as it happens, even though the diffing step itself adds work the framework has to do first. It's a genuine trade of one cost for a smaller one, not a free lunch, which is why frameworks bother.
The diffing algorithm relies on a heuristic, not an optimal tree-diff (which is prohibitively expensive to compute exactly): it assumes elements of the same type in the same position are the same element, updated in place, and it uses a key prop to track identity across reorderings — a list rendered without stable keys can cause the framework to update the wrong elements' state when items are inserted or removed in the middle, because it loses track of which virtual node corresponds to which item.
Not every framework uses this model — Svelte compiles away the diffing entirely, generating direct DOM-update code at build time — but where it's used, it's the mechanism that lets component code stay declarative ("render this given this state") while the framework handles the imperative part of turning that into efficient DOM writes.
See also7
Hydration
Attaching client-side behavior to server-rendered markup without rebuilding it.
Web Platform18 connections
Web Components
A set of browser-native APIs for building reusable, encapsulated HTML elements without a framework.
Web Platform10 connections
React Server Components
Components that execute only on the server and never ship their code to the browser.
Web Platform21 connections
Optimistic UI
Updating the UI as if a server request has already succeeded, before the server has actually responded.
Web Platform21 connections
CSS-in-JS
Writing a component's styles in JavaScript alongside its markup and logic, so styles are scoped automatically and can depend on the component's state, an approach popular in the React era whose runtime costs led to build-time variants.
Web Platform16 connections
Persistent Data Structure
Data structures that preserve every previous version when changed, sharing unchanged parts between versions so "copying" is cheap.
Computation & Algorithms9 connections
State Management
How a front-end application keeps track of the data that changes as people use it, and decides where each piece lives, from local component state to global stores to server caches.
Web Platform12 connections
Linked from6
- ANSI Escape CodeSystems & Tooling
The in-band byte sequences, starting with the escape character, that tell a terminal to move the cursor, change color, or clear the screen, inherited from 1970s video terminals and still how every command-line tool draws.
- CSS-in-JSWeb Platform
Writing a component's styles in JavaScript alongside its markup and logic, so styles are scoped automatically and can depend on the component's state, an approach popular in the React era whose runtime costs led to build-time variants.
- Optimistic UIWeb Platform
Updating the UI as if a server request has already succeeded, before the server has actually responded.
- Persistent Data StructureComputation & Algorithms
Data structures that preserve every previous version when changed, sharing unchanged parts between versions so "copying" is cheap.
- State ManagementWeb Platform
How a front-end application keeps track of the data that changes as people use it, and decides where each piece lives, from local component state to global stores to server caches.
- Web ComponentsWeb Platform
A set of browser-native APIs for building reusable, encapsulated HTML elements without a framework.