hyperscript-attribute-to-property
![javascript style guide](https://camo.githubusercontent.com/bde227e3207c7143032c0feb73889ffbda8eb1ef234b820b915ccaf74f9c66d7/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f636f64655f7374796c652d7374616e646172642d627269676874677265656e2e737667)
Convert hyperscript attributes to properties
Some html attributes have different JavaScript property names. The most annoying of these is class
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'))
hyperx
If you use the hyperx package, then this functionality is built-in and implemented via this package :)
license
MIT. Copyright (c) Feross Aboukhadijeh.