The hyperscript-helpers are hyperscript-agnostic, which means there are no dependencies.
Instead, you need to pass the implementation when you import the helpers.
Using ES6 :sparkling_heart:
const h = require('hyperscript'); // or 'virtual-hyperscript'const { div, span, h1 } = require('hyperscript-helpers')(h); // ← Notice the (h)
With React
// ✅ Preferredconst h = require('react-hyperscript');const React = require('react');const { div, span, h1 } = require('hyperscript-helpers')(h); // ← Notice the (h)// Also works, but beware of the createElement APIconst React = require('react');const { div, span, h1 } = require('hyperscript-helpers')(React.createElement); // ← Notice the (React.createElement)
Using ES5
var h = require('hyperscript'); // or 'virtual-hyperscript'var hh = require('hyperscript-helpers')(h); // ← Notice the (h)// to use the short syntax, you need to introduce them to the current scopevar div = hh.div, span = hh.span, h1 = hh.h1;
Once that's done, you can go and use the terse syntax:
To get set up, simply clone the repository, navigate to the directory on your terminal
and do the following:
# install dependenciesnpm install# build the projectnpm start# run testsnpm test# commit your changes with commitizennpm run commit# or "git cz", if you have commitizen in your PATH
The source code can be found under the src directory, and the built file is under dist.
Tests are written with Mocha, using the awesome JSVerify library.