2025-02-26
2777
#react
Ibadehin Mojeed
127976
116
Feb 26, 2025 â‹… 9 min read

What is the virtual DOM in React?

Ibadehin Mojeed I'm an advocate of project-based learning. I also write technical content around web development.

Recent posts:

React.memo explained: When to use it (and when not to)

React.memo prevents unnecessary re-renders and improves performance in React applications. Discover when to use it, when to avoid it, and how it compares to useMemo and useCallback.

Emmanuel John
Feb 26, 2025 â‹… 9 min read
React useCallback: When And How To Use It For Better Performance

React useCallback: When and how to use it for better performance

Learn how React’s useCallback hook boosts performance by memoizing functions and preventing unnecessary re-renders with practical examples and best practices.

Emmanuel John
Feb 26, 2025 â‹… 6 min read

A practical guide to switch statements in JavaScript

You might start with if...else statements. But as your logic grows more complex, you’ll discover the switch statement in JavaScript is simply better for handling multiple conditions in a clean and readable way.

Fimber Elemuwa
Feb 26, 2025 â‹… 6 min read
Building Multi-Step Forms With React Hook Form And Zod

Building a reusable multi-step form with React Hook Form and Zod

Use React Hook Form and Zod to build a multi-step form component in React that handles input validation, tracks form progress, and more.

Chinwike Maduabuchi
Feb 26, 2025 â‹… 13 min read
View all posts

6 Replies to "What is the virtual DOM in React?"

  1. Thank you for the great article it helped me understand the concept of real & virtual DOM through such amazing examples & illustrations.

    A summary of my understanding is that the main DOM is a tree structure of all the elements in the HTML page. When there’s changes in the UI, re-rendering the whole page is costly so in react there’s the concept of virtual DOM where in memory objects are used to keep track of the changes in UI. React uses reconciliation (a diffing algo to compare the snapshots of the virtual DOM tree) & ReactDOM library to update the actual DOM.

  2. Why use all this HTML in JS code? If we can render only the element where the clock will be. The Form is a separate component. The example does not contain anything useful

Leave a Reply