Skip to content

Hook useSetting()

useSetting<Type>(path: string, key: string, defaultValue: Type, parse: (value: string) => Type, stringify: (value: Type) => string): [Type, (value: string | Type) => void]

Source: settings.ts

Returns the value of a setting and a function to update it

Type Parameters

Type

Type = string

Parameters

path

string

The path of the settings file

key

string

The key of the setting

defaultValue

Type

The default value of the setting

parse

(value: string) => Type

A function that converts a string to a value

stringify

(value: Type) => string

A function that converts a value to a string

Returns

[Type, (value: string | Type) => void]

The value of a setting and a function to update it

Built by Prozilla