React Virtual DOM Vs Real DOM
React Virtual DOM Vs Real DOM
Virtual DOM
vs
WTF is a
Virtual DOM?
Real DOM re
sha
and
like
@LINKINSUNIL swipe @OFFICIALSKV
1
What is DOM?
The DOM is an abstraction of a page’s HTML
structure. It takes HTML elements and wraps them
in an object with a tree-structure — maintaining
the parent/child relationships of those nested
HTML elements. This provides an API that allows us
to traverse nodes (HTML elements) and
manipulate them in a number of ways — such as
adding nodes, removing nodes, editing a node’s
content, etc.
Ahh !!
Like a Family
Tree?
Real DOM
document
<html>
<head> <body>
<title> <meta>
Observable (fast)
Components are responsible for listening to when
an update takes place. Since the data is saved on
the state, components can simply listen to events
on the state and if there is an update, it can re-
render to the UI. React uses it.
Virtual DOM
👉 The Virtual DOM is a light-weight abstraction of
the DOM.
Additional Info
👉 Virtual DOM is pure JS file and light weight, So
capturing any update in Virtual DOM is much
faster than directly updating on Real DOM.
Want explanation on
- Reconciliation and Diffing Algorithm?
- Use of keys in lists in React?
Let me know in the comments section