1.0.1 • Published 8 years ago

snabbdom-render v1.0.1

Weekly downloads
4
License
MIT
Repository
github
Last release
8 years ago

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