useLocalStorage
Reactive localStorage binding. Thin wrapper around useStorage with ObservablePersistLocalStorage as the persist plugin.
See useStorage for details and Legend-State persist & sync for advanced options.
themelight
import { import useLocalStorage
useLocalStorage } from "@usels/web";
function function Component(): any
Component() { const const count$: any
count$ = import useLocalStorage
useLocalStorage("count", 0);
return <any
button onClick: () => any
onClick={() => const count$: any
count$.any
set(const count$: any
count$.any
get() + 1)}>Count: {const count$: any
count$.any
get()}</any
button>;}Type Declarations
Section titled “Type Declarations”export declare function useLocalStorage<T>(key: string, defaults: T): Observable<T>;Source
Section titled “Source”Contributors
Section titled “Contributors”- tigerwest
Changelog
Section titled “Changelog”a7392ab2026-03-06 - feat(core,browser): add sync strategy hooks (tigerwest)