DEV Community

Discussion on: What is Virtual Dom? And Why is it faster?

Collapse
 
shaci profile image
Ivan • Edited

Ok, but what prevents us from just writing this without using virtual DOM?:
document.querySelector('li').innerText = fruits[0]

Collapse
 
ankitlv profile image
ankitLV

Because you don't know which element got changed beforehand, it could be any.

Collapse
 
rajeshroyal profile image
Rajesh Royal

No worries man, just go and write your own diffing algorithm.

Collapse
 
siddharthshyniben profile image
Siddharth

Simple. We're lazy