The virtual DOM was created to solve browser performance issues with the actual DOM. This may not be relevant anymore, but that's why it was made.
The virtual DOM was created to solve browser performance issues with the actual DOM. This may not be relevant anymore, but that's why it was made.
The VDOM was invited to prevent bugs by removing the difficult of managing fine grade DOM mutations. Technically you are doing more work with a VDOM and diffing, than carefully mutating the DOM, it's slower.
Of course if you just threw away the whole DOM and re built it, then he's the VDOM was quicker, but that's not how anyone was building stuff.
What VDOM made easier (in terms of performance) was memoization, you could get faster if you carefully evaluated your dependencies, but to be fair, it introduced many edge-cases and many people avoid memoization to this day.
VDOM also made react-native possible, and it made cross-browser programming bearable (but other frameworks at the time did that too)
Now, one REALLY COOL thing about VDOM is fragments, because being able to render multiple elements from one component, makes certain layouts very easy using plain CSS - either with simple > * or even with CSS GRID.
I am not sure, if Svelte 4 can do that, but it's very simple thing to do with VDOM. And it certainly was not common feature for a very long time.