Redux Persist Cookie Storage Adapter
Redux Persist storage adapter for cookies. Works in the browser and in Node.js with cookie-parser output. This makes it suitable for universal / isomorphic applications.
Installation
npm install --save redux-persist-cookie-storage
Usage
Browser
Pure Cookie mode
// Cookies.defaults.domain = ... const persistConfig = key: "root" storage: Cookies/*, options */ const rootReducer = const store = const persistor =
Bootstrap from preloaded state in window object
const persistConfig = key: "root" storage: Cookies/*, options */ { // Ignore state from cookies, only use preloadedState from window object return originalState } const rootReducer = const store = const persistor =
Server
// Read-only mode: Use getStoredState method const app = app app // Read-write mode: Create persistor const configurePersistor = async { return { const persistor = }} const app = app app
Options
// By default, session cookies are used // Expiration time can be set via options // Default expiration time can be overridden for specific parts of the store: // Other cookie options like domain, path and secure:
Development
Running tests
npm test