Skip to content

@serenity-is/corelib / inNamespaceURI

Function: inNamespaceURI()

inNamespaceURI(namespaceURI, children): ComponentChildren

Defined in: ../domwise/dist/index.d.ts:2697

Executes a children factory within a scoped namespace URI.

Temporarily sets currentNamespaceURI to namespaceURI for the duration of children(), then restores the previous value (even if the factory throws). This lets you create SVG/MathML subtrees imperatively without setting namespaceURI on every element.

Parameters

namespaceURI

string

Namespace URI to activate, or null for the HTML namespace.

children

() => ComponentChildren

Factory that produces the children to render in the given namespace.

Returns

ComponentChildren

The children returned by the factory.

Example

const icon = inNamespaceURI(SVGNamespace, () => <><circle r={10} /><path d="M0 0" /></>);