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.
useURLState(key, defaultValue)
function useURLState(key: string, defaultValue: number): [number, React.Dispatch<React.SetStateAction<number>>]
A hook to manage a state variable that is also stored in the URL.
Parameters
Parameter | Type |
---|---|
key | string |
defaultValue | number |
Returns
[number
, React.Dispatch
<React.SetStateAction
<number
>>]
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.
Defined in
useURLState(key, valueOrParams)
function useURLState(key: string, valueOrParams: number | URLStateParams<number>): [number, React.Dispatch<React.SetStateAction<number>>]
A hook to manage a state variable that is also stored in the URL.
Parameters
Parameter | Type |
---|---|
key | string |
valueOrParams | number | URLStateParams <number > |
Returns
[number
, React.Dispatch
<React.SetStateAction
<number
>>]
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.