doc-jsx
A JSX pragma for document
Install
npm install --save doc-jsx
Usage with JSX
/** @jsx element */// JSX PRAGMA MUST BE THE SAME NAME AS THE IMPORT FROM 'doc-jsx' const handleClick = const component = <div class='hi'> <button onClick=handleClick>Click Me!</button> <a href='google.com'>Google</a> </div> // need to manually insert into DOMdocument
dscript
Usage with const a button div = const handleClick = const component = // need to manually insert into DOMdocument
dscript-doc
Usage with const handleClick = const component = // need to manually insert into DOMdocument
API
element(tag, attrs, children)
tag
type: string
The tag name of the element to create. For example, 'div' or 'button'.
attrs
type: object
An object of attributes and event handlers to attach to the created element.
children
type: array[Element]
| ...Element
A list of Elements to append to the created element. If a child is a string
, then it will be appended as a text node.
LICENSE
MIT © Dustin Specker