hyperscript-attribute-to-property !travistravis-imagetravis-url !npmnpm-imagenpm-url !downloadsdownloads-imagedownloads-url !javascript style guidestandard-imagestandard-url
Convert hyperscript attributes to properties
Some html attributes have different JavaScript property names. The most annoying of these isclass
v.s. className
.With this package, you can do this:
var vnode = h('div', { class: 'my-class' })
Instead of this:
var vnode = h('div', { className: 'my-class' })
Works with virtual-dom, react, hyperscript, or any DOM builder with a hyperscript-style API:
h(tagName, attrs, children)
.install
npm install hyperscript-attribute-to-property
usage
example
var attrToProp = require('hyperscript-attribute-to-property')
var h = attrToProp(require('virtual-dom/h'))