Explain what happens with React's "virtual DOM" whenever render fires, and why it's so great.

Whenever React renders the component tree, it looks for changes from the virtual DOM to the actual DOM. If there are changes, it will update only the affected nodes in the most efficient way. If there are no changes, it doesn't even touch the webpage.
This is great because Javascript is so fast, but the DOM is so slow. Whenever we have to actually go to the DOM and update elements, that's the slow part of any webpage. By having a virtual DOM where everything is updated behind the scenes and only changed in the actual DOM if there's differences, it allows our applications to become super fast.

Comments

Archive

Contact Form

Send