Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
// Virtual DOM example
var tree = render(count); // We need an initial tree
var rootNode = createElement(tree); // Create an initial root DOM node ...
document.body.appendChild(rootNode); // ... and it should be in the document
setInterval(function () {
var newTree = render(count);
var patches = diff(tree, newTree);
rootNode = patch(rootNode, patches);
tree = newTree;
}, 1000);
// jsx example
const element = (
<h2>Good to see you here.</h2>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment