Reduces boilerplate when using Virtual-DOM libraries without transpilation. It mimics React.DOM
behavior but makes it pluggable in any existent Virtual-DOM library.
npm install --save yosbelms/hfactory
HFactory objects contains convenient wrappers for all elements including SVG.
// Where `h` is the interface to create virtual-dom elements
const hfactory = require('hfactory')
const {div, strong, input} = hfactory(h)
Without destructuring
const dom = hfactory(h)
dom.footer({}, dom.span('text'))
const {div, strong} = hfactory(React.createElement)
const HelloView = (name) =>
div({className: 'info'},
strong({}, 'Hello ' + name))
ReactDOM.render(HelloView('React!'), document.getElementById('app'))
const {div, strong} = hfactory(maquette.h)
const projector = maquette.createProjector()
const HelloView = (name) => () =>
div({className: 'info'},
strong('Hello ' + name))
projector.append(document.getElementById('app'), HelloView('Maquette!'))
https://github.com/yosbelms/hfactory/tree/master/examples
MIT (c) 2016-present Yosbel Marin