Super simple hyperscript helper on 21 lines
Requires peer dependency preact
npm install hyperscriptor
import { render } from 'preact'
import { div, h1, h2 } from 'hyperscriptor'
const CoolHeadings = () => div({}, [
h1({}, 'HYPERSCRIPTOR!')
h2({}, 'Here is a subheading')
])
render(CoolHeading(), document.body)
props
work as expected, just pass in an object with the corresponding keys.
children
can be a string, element or array.
Unable to find a proper api documentation for preact's h
function,
I leave you with react's createElement
which is practically indentical.
-
Add support for using custom hyperscript functions, such as react's createElement.
-
Make it generic, not preact specific