MemorySessionStorage component stores session data within Hydrogen runtime memory.
Example codeAnchor link to section titled "Example code"
||The name of the cookie stored in the browser.|
||An optional object to configure how the cookie is persisted in the browser.|
Component typeAnchor link to section titled "Component type"
MemorySessionStorage component is a server component that renders inside
App.server.jsx. For more information about component types, refer to React Server Components.
ConsiderationsAnchor link to section titled "Considerations"
- You can store as much data as you want in the session (more than the 4kb cookie limit). However, when you close the Hydrogen server, all session data will be lost.
- If you're running Hydrogen in an Edge worker that frequently shuts down and has cold starts, then your session data will be very volatile.