Skip to content

Latest commit

 

History

History
39 lines (34 loc) · 846 Bytes

readme.md

File metadata and controls

39 lines (34 loc) · 846 Bytes

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