API Reference / @gtkx/react / config / createElementComponent
Variable: createElementComponent
constcreateElementComponent: <P>(typeName,cls?,metadata?) => (props) =>ReactNode
Defined in: components/element.d.ts:20
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.
cls?
unknown
Wrapper class the name resolves to. Referencing it keeps the class, and with it the registration the reconciler's name lookup depends on, in a tree-shaken bundle; the component itself renders through the name.
metadata?
unknown
Registered metadata entry for the type. Referencing it keeps the type's property and signal tables, which register themselves when evaluated, in a tree-shaken bundle.
Returns
A component taking that type's props.
(props) => ReactNode