Create a RAF loop for
virtual-dom.
$ npm install virtual-raf
const vraf = require('virtual-raf')
const vdom = require('virtual-dom')
const h = require('virtual-dom/h')
function render (state) {
return h('div', [state.count])
}
const tree = vraf({ count: 1 }, render, vdom)
document.body.appendChild(tree.render())
tree.update({ count: 2 })
Create a virtual-dom tree based on a state and render function.
Mount the virtual-dom tree on a DOM node.
Update the tree with an optional new state and render function.