<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>virtual dom vs real dom in react - Wikitechy</title>
	<atom:link href="https://www.wikitechy.com/interview-questions/tag/virtual-dom-vs-real-dom-in-react/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.wikitechy.com/interview-questions/tag/virtual-dom-vs-real-dom-in-react/</link>
	<description>Interview Questions</description>
	<lastBuildDate>Tue, 29 Mar 2022 12:11:27 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9</generator>

<image>
	<url>https://www.wikitechy.com/interview-questions/wp-content/uploads/2025/10/cropped-wikitechy-icon-32x32.png</url>
	<title>virtual dom vs real dom in react - Wikitechy</title>
	<link>https://www.wikitechy.com/interview-questions/tag/virtual-dom-vs-real-dom-in-react/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>What is virtual DOM ?</title>
		<link>https://www.wikitechy.com/interview-questions/reactjs/what-is-virtual-dom/</link>
					<comments>https://www.wikitechy.com/interview-questions/reactjs/what-is-virtual-dom/#respond</comments>
		
		<dc:creator><![CDATA[webmaster]]></dc:creator>
		<pubDate>Tue, 22 Mar 2022 06:51:48 +0000</pubDate>
				<category><![CDATA[ReactJS]]></category>
		<category><![CDATA[advantages of virtual dom in react]]></category>
		<category><![CDATA[react virtual dom]]></category>
		<category><![CDATA[virtual dom]]></category>
		<category><![CDATA[virtual dom example]]></category>
		<category><![CDATA[virtual dom full form]]></category>
		<category><![CDATA[virtual dom in react]]></category>
		<category><![CDATA[virtual dom in react js]]></category>
		<category><![CDATA[virtual dom react]]></category>
		<category><![CDATA[virtual dom vs real dom]]></category>
		<category><![CDATA[virtual dom vs real dom in react]]></category>
		<category><![CDATA[what is dom in react]]></category>
		<category><![CDATA[what is real dom]]></category>
		<category><![CDATA[what is virtual dom in react]]></category>
		<guid isPermaLink="false">https://www.wikitechy.com/interview-questions/?p=3969</guid>

					<description><![CDATA[It is a lightweight JS object which is an in-memory representation of real DOM. It is a programming concept where an ideal, or “virtual”, representation of a UI is kept in memory and synced with the “real” DOM by a library such as ReactDOM. Virtual DOM has the same properties as that of the Real DOM, however [&#8230;]]]></description>
										<content:encoded><![CDATA[<ul>
<li style="text-align: justify;">It is a lightweight JS object which is an in-memory representation of real DOM.</li>
<li style="text-align: justify;">It is a programming concept where an ideal, or “virtual”, representation of a UI is kept in memory and synced with the “real” DOM by a library such as ReactDOM.</li>
<li style="text-align: justify;"><a href="https://www.wikitechy.com/tutorials/react/reactjs-dom-vs-virtual-dom">Virtual DOM</a> has the same properties as that of the Real DOM, however it lacks the power to directly change the content of the screen.</li>
<li style="text-align: justify;">It is also considered as a part of “virtual DOM” implementation in React.</li>
<li style="text-align: justify;">Although the concept has been around for several years, it was made more popular by its use in the React framework.</li>
<li style="text-align: justify;">It is Created by “<strong>Richie Harris</strong>”.</li>
</ul>
<h4 id="why-do-we-need-a-virtual-dom">Why do we need a virtual DOM ?</h4>
<ul>
<li>In our client-side application has a super complex structure, which will result in a complicated DOM tree.</li>
<li>Manipulating DOM at once can without problems result in overall performance.</li>
</ul>
<p>For example, let’s take this simple HTML document with an unordered list one list item.</p>
<div class="code-embed-wrapper"> <div class="code-embed-infos"> </div> <pre class="language-markup code-embed-pre line-numbers"  data-start="1" data-line-offset="0"><code class="language-markup code-embed-code">&lt;!doctype html&gt;<br/>&lt;html lang=&quot;en&quot;&gt;<br/> &lt;head&gt;&lt;/head&gt;<br/><br/> &lt;body&gt;<br/>    &lt;ul class=&quot;list&quot;&gt;<br/>        &lt;li class=&quot;list__item&quot;&gt;List item&lt;/li&gt;<br/>    &lt;/ul&gt;<br/>  &lt;/body&gt;<br/>&lt;/html&gt;</code></pre> </div>
<p>This document can be represented as the following DOM tree.</p>
<p><img fetchpriority="high" decoding="async" class="alignnone wp-image-4043 size-full" src="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/03/what-is-virtual-dom-1.png" alt="" width="561" height="321" srcset="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/03/what-is-virtual-dom-1.png 561w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/03/what-is-virtual-dom-1-300x172.png 300w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/03/what-is-virtual-dom-1-390x223.png 390w" sizes="(max-width: 561px) 100vw, 561px" /></p>
<p>We need to adjust the content of the first list item to &#8220;List item one&#8221; and also add a 2nd listing object. we will need use the DOM APIs to find the elements we need to replace, create the new elements, upload attributes and content, then finally replace the DOM elements themselves.</p>
<div class="code-embed-wrapper"> <div class="code-embed-infos"> </div> <pre class="language-markup code-embed-pre line-numbers"  data-start="1" data-line-offset="0"><code class="language-markup code-embed-code">const listItemOne = document.getElementsByClassName(&quot;list__item&quot;)[0];<br/>listItemOne.textContent = &quot;List item one&quot;;<br/><br/>const list = document.getElementsByClassName(&quot;list&quot;)[0];<br/>const listItemTwo = document.createElement(&quot;li&quot;);<br/>listItemTwo.classList.add(&quot;list__item&quot;);<br/>listItemTwo.textContent = &quot;List item two&quot;;<br/>list.appendChild(listItemTwo);</code></pre> </div>
]]></content:encoded>
					
					<wfw:commentRss>https://www.wikitechy.com/interview-questions/reactjs/what-is-virtual-dom/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
