Skip to content

Function: useLocalStorage() ​

ts
function useLocalStorage<P, M>(options): Ref<InferInputValue<P, UnwrapOption<M>>, InferInputWritable<P, UnwrapOption<M>>>;

Defined in: storage/use-storage.ts:135

Keeps one value in local storage, which every tab of the site shares, and returns a ref over it.

Type Parameters ​

Type ParameterDefault type
P extends ParserInput | undefinedundefined
Mnull

Parameters ​

ParameterType
optionsUseLocalStorageOptions<P, M>

Returns ​

Ref<InferInputValue<P, UnwrapOption<M>>, InferInputWritable<P, UnwrapOption<M>>>

Released under the MIT License.