Hacker News new | ask | show | jobs
by curist 2211 days ago
VirtualDOM is more of an implementation detail IMO. What I love about React is for its declarative API and we can compose components easily.
1 comments

I agree. I love that about React. I think all UI libraries could learn a ton from React.https://medium.com/@ryansolid/what-every-javascript-framewor...

But it isn't something that completely gets abstracted. There is a reason it has been so difficult to make a non-virtual Dom version of React. It isn't impossible, but has yet to fully flesh out despite attempts by a few projects including members of the React team.

So React needs VirtualDOM? Do people want React not to be dependent on VirtualDOM. Is there a reason/benefit?
You might get some answers here, from an SO comment written by virtual-dom’s author: https://stackoverflow.com/questions/21109361/why-is-reacts-c...

The link has been posted in another comment too, here are some chunks that may be relevant to you:

> A virtual DOM is nice because it lets us write our code as if we were re-rendering the entire scene. Behind the scenes we want to compute a patch operation that updates the DOM to look how we expect. So while the virtual DOM diff/patch algorithm is probably not the optimal solution, it gives us a very nice way to express our applications. We just declare exactly what we want and React/virtual-dom will work out how to make your scene look like this. We don't have to do manual DOM manipulation or get confused about previous DOM state. We don't have to re-render the entire scene either, which could be much less efficient than patching it.