snabbdom-render

A rendering loop for snabbdom.

Usage no npm install needed!

<script type="module">
  import snabbdomRender from 'https://cdn.skypack.dev/snabbdom-render';
</script>

README

snabbdom-render

NPM version License Build status

A rendering loop for snabbdom.

Installation

npm install snabbdom-render

Usage

import snabbdom from 'snabbdom'
import h from 'snabbdom/h'
import render from 'snabbdom-render'

const patch = snabbdom.init([])
const tree = () => h('p', new Date().toISOString())
const root = document.getElementById('root')

const update = render(patch, tree, root)
setInterval(update, 3000)

For an example built with Redux, see examples/counter.

API

update = render(patch, tree, root)

Use patch to render the given tree on the root node.

License

MIT