createCookieSessionStorage
On this page

createCookieSessionStorage

Summary

Reference Documentation ↗

Creates and returns a SessionStorage object that stores all session data directly in the session cookie itself.

This has the advantage that no database or other backend services are needed, and can help to simplify some load-balanced scenarios. However, it also has the limitation that serialized session data may not exceed the browser's maximum cookie size. Trade-offs!

Signature

function createCookieSessionStorage<Data = SessionData, FlashData = Data>({
  cookie: cookieArg,
}: CookieSessionStorageOptions = {}): SessionStorage<Data, FlashData>

Params

options

Options for creating the cookie-backed session storage.

Returns

A SessionStorage object that stores all session data in its cookie.

Docs and examples CC 4.0
Edit