Skip to main content

Function: useURLState()

A hook to manage a state variable that is also stored in the URL.

Param​

The name of the key in the URL. If empty, then the hook behaves like useState.

Param​

The default value of the state variable, or the params object.

Call Signature​

function useURLState(key: string, defaultValue: number): [number, Dispatch<SetStateAction<number>>];

Defined in: lib/util.ts:360

Parameters​

ParameterType
keystring
defaultValuenumber

Returns​

[number, Dispatch<SetStateAction<number>>]

Call Signature​

function useURLState(key: string, valueOrParams: number | URLStateParams<number>): [number, Dispatch<SetStateAction<number>>];

Defined in: lib/util.ts:364

Parameters​

ParameterType
keystring
valueOrParamsnumber | URLStateParams<number>

Returns​

[number, Dispatch<SetStateAction<number>>]