Skip to content

API Reference / @gtkx/react / index / useProperty

Function: useProperty() ​

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

Defined in: hooks/use-property.d.ts:13

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

Type Parameters ​

T ​

T extends Object

P ​

P extends string | number | symbol

Parameters ​

object ​

RefProp<T>

propertyName ​

P & string

The camelCase name of a readable property on the object.

Returns ​

T[P] | undefined

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

Released under the MPL-2.0 License.