0.0.4 • Published 7 years ago

hyperscriptor v0.0.4

Weekly downloads
4
License
MIT
Repository
github
Last release
7 years ago

Hyperscriptor

Super simple hyperscript helper on 21 lines

Usage

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)

API

element(props, children)

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.

TBD

  • Add support for using custom hyperscript functions, such as react's createElement.

  • Make it generic, not preact specific