leptos_use::storage

Function use_session_storage

Source
pub fn use_session_storage<T, C>(
    key: impl AsRef<str>,
) -> (Signal<T>, WriteSignal<T>, impl Fn() + Clone)
where T: Clone + Default + PartialEq, C: Encoder<T, Encoded = String> + Decoder<T, Encoded = str>,
Expand description

Reactive SessionStorage.

SessionStorages stores data in the browser that is deleted when the page session ends. A page session ends when the browser closes the tab. Data is not shared between pages. While data doesn’t expire the user can view, modify and delete all data stored. Browsers allow 5MB of data to be stored.

Use crate::storage::use_local_storage to store data that is shared amongst all pages with the same origin and persists between page sessions.

§Usage

See crate::storage::use_storage for more details on how to use.