Skip to content
This repository has been archived by the owner on Feb 14, 2019. It is now read-only.

Latest commit

 

History

History
 
 

render

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

flimflam/render

The flimflam render function takes a view function, a state object, a plain DOM node and renders your UI component into the web browser's page.

You only need to call render once per page and per top-level component. You may render multiple components to the same page -- just be sure to use different containers.

You can use it like this:

const render = require('flimflam/render')
const h = require('flimflam/h')

function initState() {
  return {x: 'hallo world'}
}

function view(state) {
  return h('div', [
    h('p', state.x)
  ])
}

const container = document.querySelector('.my-container')
render(view, initState(), container)