Accron Revolutions

The Lab/Web Development

JavaScriptandtheVirtualDOM

Why every modern framework refuses to touch the real DOM — and what the virtual one actually buys you.

Thishan Paramanayagam··2 min read

JavaScript and the Virtual DOM — article cover
Photo: Florian Olivo / Unsplash

Understanding the Virtual DOM

The Document Object Model (DOM) is the interface between your JavaScript code and the browser's rendering engine. Manipulating the real DOM is notoriously slow. React's Virtual DOM is the solution.

Real DOM
Slow, expensive updates
Virtual DOM
Fast, in-memory updates

01 Diffing Algorithm

When the state of an application changes, updates are first applied to the Virtual DOM. A "diffing" algorithm then compares the updated Virtual DOM with the previous version to identify exactly what changed.

Reconciliation

The process of calculating changes and applying them in a single batch to the real DOM to minimize performance costs.

Read next

From the lab to your business

Like how we think? See how we build.

The same thinking in these articles goes into every project we ship — apps, platforms, cloud systems and Accron POS.

Explore our solutions

Or start a conversation — /contact