vdom-thunk

A thunk optimization for virtual-dom

Usage no npm install needed!

<script type="module">
  import vdomThunk from 'https://cdn.skypack.dev/vdom-thunk';
</script>

README

vdom-thunk

A thunk optimization for virtual-dom

Example

Use partial when you want to avoid re-rendering subtrees.

partial will only re-evaluate the subtree if the arguments you pass to it change. This means you should use an immutable data structure (like observ-struct)

var partial = require("vdom-thunk")

function render(state) {
  return h('div', [
    partial(header, state.head),
    main(),
    partial(footer, state.foot)
  ])
}

function header(head) { ... }
function main() { ... }
function footer(foot) { ... }

Installation

npm install vdom-thunk

Contributors

  • Raynos

MIT Licenced