incremental-hyperscript
A hyperscript-like interface for Incremental DOM
Usage
Use h
to create render functions, and call them within patch
:
var h = hvar patch = patch { var text = datashouldSpeakToUniverse ? 'Hello universe!' : 'Hello world!' return } var someData = shouldSpeakToUniverse: false var otherData = shouldSpeakToUniverse: true
API
h(tagName, [properties], [children])
tagName
(required) - A string representing a tag name (e.g.,span
).properties
(optional) - An object specifying properties (and their corresponding values) to be set on the element.children
(optional) - A string, function, or array (of strings and/or functions). If a string, a single text node child will be rendered. If a function, a single child element (created and returned by the function) will be rendered. If an array, several children (either text node or elements) will be rendered.
Returns a render function to be called within patch
.
Install
With npm installed, run
$ npm install --save incremental-hyperscript incremental-dom
Acknowledgments
incremental-hyperscript was inspired by hyperscript, virtual-dom, and React.
See Also
License
Apache-2.0