use_session_storage
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 use_local_storage to store data that is shared amongst all pages with the same origin and persists between page sessions.
Usage
See use_storage for more details on how to use.
Installation
cargo add leptos-use-storage
Options
UseStorageOptions
Options for use with use_local_storage_with_options, use_session_storage_with_options and use_storage_with_options.
Options for use_storage_with_options.
The filter is a type parameter so that the debounce and throttle code is only compiled into your app if you use it.
Every option is set with a builder method of the same name, e.g. UseStorageOptions::default().on_error(...). See also the API docs.
on_error
Type: Arc<dyn Fn(UseStorageError<E, D>) + Send + Sync>
listen_to_storage_changes
Type: bool
initial_value
Type: MaybeRwSignal<T>
filter
Type: F
delay_during_hydration
Type: bool
Delays the reading of the value from storage by one animation frame during hydration.
This ensures that during hydration the value is the initial value just like it is on the server
which helps prevent hydration errors. Defaults to false.