A storage adapter for redux-persist that uses cookies as the persistence medium. Version 1.0.0 is the latest. It works in both browser (with cookies-js) and Node.js (with cookie-parser or cookies), enabling universal/isomorphic apps. Key differentiator: unlike localStorage-based adapters, cookies are automatically sent with HTTP requests, making it suitable for server-side rendering scenarios. The library supports cookie expiration and domain/path options.
npm install redux-persist-cookie-storageNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates setting up redux-persist with cookie storage in a browser environment using cookies-js and optional expiration.
Only persist small state slices; use compression or limit deserialization to essential data.
Wrap getStoredState in try/catch and default to empty initial state.
For deletion, set maxAge to 0 or remove the cookie manually via cookies-js.
Ensure you pass the Cookies object from 'cookies-js' (or NodeCookiesWrapper) to the constructor: new CookieStorage(Cookies)
Wrap getStoredState in try/catch and fallback to empty state: try { await getStoredState(config) } catch { preloadedState = {} }