F

useSetting

React hook that selects from a Bucket, re-rendering only when the selection changes.

function useSetting<T>(name: string, selector: (bucket: Bucket) => T, isEqual?: (previous: T, next: T) => boolean): T

Parameters

NameTypeDescription
namestring

The Bucket to read.

selector(bucket: Bucket) => T

Reads the value from the Bucket.

isEqual?(previous: T, next: T) => boolean

Decides whether a new selection equals the last one, which skips the re-render. Defaults to Object.is.

Returns

T

The selector's latest value.