Skip to content

API Reference / @gtkx/react / config / defineBehavior

Function: defineBehavior() ​

defineBehavior<T>(hooks): ElementBehavior<never>

Defined in: packages/react/src/reconciler/registry.ts:147

Types one behavior against the GObject class it applies to, so every hook's object parameter is inferred rather than annotated by hand. Pass the class as the type argument.

ts
defineElements({
    GtkFrame: { behaviors: [defineBehavior<Gtk.Frame>({ attach: (frame, child) => frame.setChild(child) })] },
});

Type Parameters ​

T ​

T extends Object

Parameters ​

hooks ​

ElementBehavior<T>

Returns ​

ElementBehavior<never>