(If you want a value of the checkbox component, you had to ask it by calling a method, and that would in turn ask the DOM. Debugging and refactoring that was hell (by modern standards). Not as in "oh no, derived state here and there", but as in "there is state in every little crevice of my SPA". (The framework only cared about giving you a zoo of components.) State propagation was very error-prone, because you had to do it manually.Working with those was very problematic in many ways: Newer frameworks know how to know which state changes are relevant to which DOM nodes, making the Virtual DOM approach redundant.īefore React & Friends, popular frameworks and libraries were very stateful and object-oriented. Virtual DOM solves the problem of aggressive re-rendering. Would really appreciate if you explain this to me in details or give me some links to in-depth articles/videos on this topic. If VDOM works like this then why does it traverse the whole structure and tag nodes that has to be updtaed? Why not just wait until there is no more changes to the structure and just update the whole DOM? Not traversing and tagging nodes? So VDOM would change 5 element in one update while real DOM would need 5 updates to change 5 elements. While the real DOM updates the whole nodes structure right away everytime something changes the structure. Some articles say that the VDOM accumulates updates and then rerender the whole DOM at once. If the real DOM is able to update only necessary parts of the whole structure then why do we need the VDOM? Why isn't it a built-in DOM behaviour? Second question: how does VDOM make the real DOM update only necessary elements? Why does DOM not do that itself? Since VDOM can't affect the nodes structure it will eventually ask the real DOM do all the necessary updates. If I'm wrong then what make the VDOM lightweight? So the first question: how is Virtual DOM lightweight? Since it can't affect the nodes structure I assume VDOM does not have some methods that the real one has (like. As all articles say the Virtual DOM is lightweight and allows us to update only those nodes that has to be updated, unlike the real DOM that updates the whole nodes structure.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |