How does virtual DOM work, and what are its advantages?

Technical