Skip to content

semibran/h

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

h

Create virtual DOM nodes

usage

h uses the standard h(tag, attributes, children) signature. Note that children, if provided, is always an array to minimize type checks:

> h("div", { class: "foo" }, [ "hello world" ])
{
  tag: "div",
  attributes: { class: "foo" },
  children: [ "hello world" ]
}

attributes defaults to an empty object and thus can be omitted.

> h("h1", [ "title" ])
{
  tag: "h1",
  attributes: {},
  children: [ "title" ]
}

The same principle applies to children, except with an empty array.

> h("br")
{
  tag: "br",
  attributes: {},
  children: []
}

see also

license

MIT © Brandon Semilla

Releases

No releases published

Packages

No packages published