tagl
universal hyperscript helper for fancy syntax
why
Writing hyperscript can be cumbersome. This might be an alternative to JSX and alike
what
Imagine instead of
<button ="btn">Click Me</button>
or this
you can write
button
Well thats possible with tagl
how
Init tagl with your hyperscript lib, e. g. mithril.js.
const t =
or react
const t =
// myView.jsconst div span button = t div
same in plain mithril would be
const m =
components
There are two ways to create and use components. One global and one local. Use global components for general reusable widgets like date picker or dropdowns and alike.
// define it and set it on the tagl instance // `myDatePicker` must be a component definition that is supported by your vdom library// it will be used instead of the tag nametdatePicker = myDatePicker // use it const div datePicker = t
Sometimes you just need sub-state at a specific point and you don't want to create a globaly available component. In this case you can use local components.
const div = t // define it and store it in a variable// `myDatePicker` must be a component definition that is supported by your vdom library// it will be used instead of the tag nameconst myLocalComponent = // use it