Small, Fast, & Simple

March 26, 2015

Virtual DOM

Small
Fast
Simple

Facebook’s React introduced the pattern of using a virtual DOM to construct and update a webpage. The solution is elegant, but the implementation is tightly integrated into React’s core. Instead, use virtual-dom, a minimal library that does DOM diffing without need for the much larger React. Using virtual-dom is as simple as creating a virtual DOM tree, attaching it to an actual DOM node, then when changes are needed, generating a new virtual DOM tree, diffing against the old one, and applying only the changes that are needed to the actual DOM.