[Vuejs]-What does it mean by virtual dom is in-memory?

0👍

Virtual DOM is just a javascript object in memory. While DOM is also mainly in memory (no in disk and on the cloud), it’s a complex system with many parts connected.

The difference is that DOM is slow. Manipulating DOM involves many other tasks (https://stackoverflow.com/a/6817110/8810271). Manipulating a virtual DOM without other tasks is no more than a javascript object, which is much faster than element.innerHTML=x.

But remember you still need to manipulate DOM after diffing virtual DOM, to make changes take effect. And it isn’t always faster.

Leave a comment