Skip to content

API Reference / @gtkx/react / useSetting

Function: useSetting()

useSetting<K, P>(schema, key): [K[P], (value) => void]

Defined in: react/dist/hooks/use-setting.d.ts:24

Reads and writes a single key of a GSettings schema, re-rendering when the stored value changes.

Type Parameters

K

K extends object

P

P extends string

Parameters

schema

SchemaRef<K>

The schema reference identifying the settings backend.

key

P

The key within the schema to read and write.

Returns

[K[P], (value) => void]

A tuple of the current value and a setter that persists a new value.

Released under the MPL-2.0 License.