Skip to content
On this page

useLocalStorage

Category
Last Changed
3 months ago

Reactive LocalStorage.

Usage

Please refer to useStorage

Type Declarations

export declare function useLocalStorage(
  key: string,
  initialValue: MaybeRef<string>,
  options?: StorageOptions<string>
): RemovableRef<string>
export declare function useLocalStorage(
  key: string,
  initialValue: MaybeRef<boolean>,
  options?: StorageOptions<boolean>
): RemovableRef<boolean>
export declare function useLocalStorage(
  key: string,
  initialValue: MaybeRef<number>,
  options?: StorageOptions<number>
): RemovableRef<number>
export declare function useLocalStorage<T>(
  key: string,
  initialValue: MaybeRef<T>,
  options?: StorageOptions<T>
): RemovableRef<T>
export declare function useLocalStorage<T = unknown>(
  key: string,
  initialValue: MaybeRef<null>,
  options?: StorageOptions<T>
): RemovableRef<T>
export declare function useLocalStorage(
  key: string,
  initialValue: MaybeRef<string>,
  options?: StorageOptions<string>
): RemovableRef<string>
export declare function useLocalStorage(
  key: string,
  initialValue: MaybeRef<boolean>,
  options?: StorageOptions<boolean>
): RemovableRef<boolean>
export declare function useLocalStorage(
  key: string,
  initialValue: MaybeRef<number>,
  options?: StorageOptions<number>
): RemovableRef<number>
export declare function useLocalStorage<T>(
  key: string,
  initialValue: MaybeRef<T>,
  options?: StorageOptions<T>
): RemovableRef<T>
export declare function useLocalStorage<T = unknown>(
  key: string,
  initialValue: MaybeRef<null>,
  options?: StorageOptions<T>
): RemovableRef<T>

Source

SourceDocs

Contributors

Anthony Fu
Antério Vieira
Shinigami
Pig Fang
Alex Kozack

Changelog

v6.9.2 on 11/19/2021
80409 - fix: interface typos (#938)
v6.3.3 on 9/12/2021
d6dd1 - feat(useStorage): support writing null value to storage, close #452
8a9c4 - feat(useStorage): support pass ref to useStorage
v4.11.1 on 5/24/2021
e6eb5 - feat(useStorage): allow custom serializer (#528)
v4.11.1 on 5/24/2021
f4d53 - feat(useStorage): allow custom serializer (#528)
useLocalStorage has loaded