vdom-thunk
Version:
A thunk optimization for virtual-dom
61 lines (45 loc) • 1.46 kB
Markdown
1]][2]
[![NPM version][3]][4]
[![Coverage Status][5]][6]
[![gemnasium Dependency Status][7]][8]
[![Davis Dependency status][9]][10]
-->
<!-- [![browser support][11]][12] -->
A thunk optimization for virtual-dom
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`)
```js
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) { ... }
```
`npm install vdom-thunk`
- Raynos
[ ]: https://secure.travis-ci.org/Raynos/vdom-thunk.png
[ ]: https://travis-ci.org/Raynos/vdom-thunk
[ ]: https://badge.fury.io/js/vdom-thunk.png
[ ]: https://badge.fury.io/js/vdom-thunk
[ ]: https://coveralls.io/repos/Raynos/vdom-thunk/badge.png
[ ]: https://coveralls.io/r/Raynos/vdom-thunk
[ ]: https://gemnasium.com/Raynos/vdom-thunk.png
[ ]: https://gemnasium.com/Raynos/vdom-thunk
[ ]: https://david-dm.org/Raynos/vdom-thunk.png
[ ]: https://david-dm.org/Raynos/vdom-thunk
[ ]: https://ci.testling.com/Raynos/vdom-thunk.png
[ ]: https://ci.testling.com/Raynos/vdom-thunk
<!--
[![build status][