Skip to content

API Reference / @gtkx/react / index / useProperty

Function: useProperty() ​

useProperty<T, P>(object, propertyName): ReadableProperties<T>[P] | undefined

Defined in: packages/react/src/hooks/use-property.ts:17

Subscribes to a GObject property and returns its current value, re-rendering when the property changes.

Type Parameters ​

T ​

T extends Pick<Object, "__properties__" | "__type__">

P ​

P extends string

Parameters ​

object ​

T | null | undefined

propertyName ​

P

The camelCase name of a readable property on the object.

Returns ​

ReadableProperties<T>[P] | undefined

The current value, or undefined while the object is null.