Skip to content

useSessionStorage

Reactive sessionStorage binding. Thin wrapper around useStorage with ObservablePersistSessionStorage as the persist plugin. Values persist only for the current browser session.

See useStorage for details and Legend-State persist & sync for advanced options.

wizard step1 / 5
import {
import useSessionStorage
useSessionStorage
} from "@usels/web";
function
function Component(): any
Component
() {
const
const step$: any
step$
=
import useSessionStorage
useSessionStorage
("wizard-step", 1);
return (
<
any
div
>
<
any
p
>Step: {
const step$: any
step$
.
any
get
()}</
any
p
>
<
any
button
onClick: () => any
onClick
={() =>
const step$: any
step$
.
any
set
(
const step$: any
step$
.
any
get
() + 1)}>Next</
any
button
>
</
any
div
>
);
}
export declare function useSessionStorage<T>(key: string, defaults: T): Observable<T>;

View on GitHub

  • tigerwest
  • a7392ab 2026-03-06 - feat(core,browser): add sync strategy hooks (tigerwest)