4 ms·
I am kinda new and here is one confusion I still have about frameworks like Vue or React, why do we still need Virtual DOM? Shouldn't the browser DOM already be
by tiuPapa 9y ago
I am kinda new and here is one confusion I still have about frameworks like Vue or React, why do we still need Virtual DOM? Shouldn't the browser DOM already be first enough?
- fbonetti 9y agoThe virtual DOM automatically updates the real DOM for you, in a way that only touches the parts that have actually changed. Think of it like a diff. This allows developers to focus on the business logic and presentation of their apps without worrying about how to update the DOM efficiently to match the current app state.
- dakom 9y agoHah! This is a fantastic question... isn't the whole point of HTML that it's a declarative markup language? Isn't the browser supposed to be focused on dealing with a diff between the markup/state changes - and doing it fast? The DOM itself _is_ a virtual model thing... why do we need to abstract over it- and somehow get performance benefits from an abstraction over an abstraction? Afaik you can't even force a repaint beyond rAF... Something doesn't smell right.
- EdwardMSmith 9y agoIf you’re not sure of the “why” of react, I’ve found that Pete Hunt’s talk “Rethinking Best Practices” gives a great overview of the reasoning behind react. Especially from about 15:15. https://youtu.be/x7cQ3mrcKaY https://youtu.be/x7cQ3mrcKaY