Cookies are accessed like any other Var in the state. If another state needs access
to the value of a cookie, the state should be a substate of the state that defines
the cookie. Alternatively the get_state API can be used to access the other state.
For rendering cookies in the frontend, import the state that defines the cookie and
reference it directly.
Two separate states should avoid defining rx.Cookie with the same name.
Because LocalStorage applies to the entire browser, all LocalStorage Vars are
automatically shared across tabs.
The sync parameter controls whether an update in one tab should be actively
propagated to other tabs without requiring a navigation or page refresh event.
Clear all local storage items from the client's browser. This may affect other
apps running in the same domain or libraries within your app that use local
storage.
Represents a state Var that is stored in sessionStorage in the browser. Similar to localStorage, but the data is cleared when the page session ends (when the browser/tab is closed). Currently only supports string values.
Parameters
name: The name of the storage key on the client side.
SessionStorage data is cleared when the page session ends. A page session lasts as long as the browser is open and survives page refreshes and restores, but is cleared when the tab or browser is closed.
Unlike LocalStorage, SessionStorage is isolated to the tab/window in which it was created, so it's not shared with other tabs/windows of the same origin.
Clear all session storage items from the client's browser. This may affect other
apps running in the same domain or libraries within your app that use session
storage.
If a non-trivial data structure should be stored in a Cookie, LocalStorage, or SessionStorage var it needs to be serialized before and after storing it. It is recommended to use a pydantic class for the data which provides simple serialization helpers and works recursively in complex object structures.