Skip to content

API Reference / @gtkx/react / useProperty

Function: useProperty()

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

Defined in: react/dist/hooks/use-property.d.ts:12

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

Type Parameters

T

T extends Object

K

K extends string

Parameters

object

ObjectProp<T>

The GObject (or ref to one) whose property to observe.

propertyName

K

The camelCase name of a readable property on the object.

Returns

T[K] | undefined

The current property value, or undefined when the object is not resolved.

Released under the MPL-2.0 License.