h() — Compact Notation
A compact array-based notation for building vnode trees. An alternative tocreateElement that reads closer to the structure it describes.
Syntax
type— a tag name string ('div') or a registered component name ('Button')props— optional object of attributes or propschildren— remaining items, each a nested array or a primitive
Registry dispatch
If the type matches a registered component name,h() calls that component instead of createElement:
ContractError.
Nested trees
Children on registered components
Whenh() calls a registered component and there are child nodes, they’re passed as a children prop — not spread as arguments. The component must declare children in its schema to receive them.
div, ul, etc.), children are passed as normal arguments to createElement — no prop involved.
When to use h() vs createElement
h() is more compact and closer to markup in structure. createElement is more explicit and easier to trace in a debugger. Both produce identical vnodes — mix them freely.
h() is particularly well-suited as a generation target: the array format is easy for a model to produce without needing to know function call syntax.