Skip to content
This repository has been archived by the owner on Nov 14, 2020. It is now read-only.

pinn3/hyperscriptor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Super simple hyperscript helper on 21 lines

Resources

License

Stars

Watchers

Forks

Packages

No packages published