JsxChild
Everything a JSX expression can produce or a child can be: DOM nodes, text, numbers, booleans, nothing, accessors (() => child, re-run when their dependencies change) and nested arrays.
Everything a JSX expression can produce or a child can be: DOM nodes, text, numbers, booleans,
nothing, accessors (() => child, re-run when their dependencies change) and nested arrays.
JSX.Element is this type.
Import#
ts
import type { JsxChild } from "@shadow-js/web";
Signature#
ts
type JsxChild =
| Node
| string
| number
| boolean
| null
| undefined
| (() => JsxChild)
| readonly JsxChild[]
Examples#
ts
import type { JsxChild } from "@shadow-js/web";
function list(items: readonly string[]): JsxChild {
return items.length === 0 ? "Nothing yet" : items.map((item) => <li>{item}</li>);
}