Skip to content

API Reference / @gtkx/react / config / createElementComponent

Function: createElementComponent()

createElementComponent<P>(typeName): (props) => ReactNode

Defined in: components/element.d.ts:15

Builds the component that renders the element of a GLib type, which is how the generated @gtkx/jsx store exposes every widget. Reach for it to render a type codegen does not cover, such as one registerClass created: the element name is the GType name, and the component routes each prop whose value is an element into that prop's slot, which a bare intrinsic element cannot do.

Name the props the element takes as the type argument, since the GType name says nothing about them. Left out, the component takes unknown, which accepts no attributes at all.

Type Parameters

P

P = unknown

Parameters

typeName

string

GType name to render, such as GtkButton or the typeName given to registerClass.

Returns

A component taking that type's props.

(props) => ReactNode

Released under the MPL-2.0 License.