zustand-cookie-storage v1.1.1 is a lightweight utility for persisting Zustand store state in cookies. It integrates with Zustand's built-in persist middleware via `createJSONStorage(() => cookieStorage)`. Key differentiator: purely cookie-based persistence (no localStorage/IndexedDB), making it suitable for server-side rendering or scenarios where cookies are mandatory. The library is actively maintained, with TypeScript types included. It offers limited customization of cookie attributes but does not support asynchronous storage adapters. Alternatives include zustand/middleware's default storage and zustand-persist.
npm install zustand-cookie-storageNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates creating a Zustand store with cookie persistence using the persist middleware.
Use createJSONStorage(() => cookieStorage) as shown in the example.
Use partialize option to persist only necessary state fields.
Use named import: import { cookieStorage } from 'zustand-cookie-storage'Use createJSONStorage(() => cookieStorage) in the persist configuration.
No dependency data recorded yet.