How Virtual DOM Works?
When you render a JSX element, every single virtual DOM object gets updated.This sounds incredibly inefficient, but the cost is insignifica...
By comparing the new virtual DOM with a pre-update version, React figures out exactly which virtual DOM objects have changed. This process is called "diffing."
Once React knows which virtual DOM objects have changed, then React updates those objects, and only those objects, on the real DOM.