Adapter for cookie-baker↗.
npm i @reatom/npm-cookie-baker @cookie-baker/core
or
yarn add @reatom/npm-cookie-baker @cookie-baker/core
yarn add @cookie-baker/browser
npm install @cookie-baker/browser
yarn add @cookie-baker/node
npm install @cookie-baker/node
codesandbox↗
import { Cookie as CookieClient, createRealTimeCookie,} from '@cookie-baker/browser'import { reatomCookie } from '@reatom/npm-cookie-baker' type CookieModel = { ga?: string adc?: string} const cookie = new CookieClient<CookieModel>()const realTimeCookie = createRealTimeCookie(cookie) const { cookieAtom, set, remove } = reatomCookie(cookie, realTimeCookie) const ctx = createContext()ctx.subscribe(cookieAtom, console.log) set(ctx, 'adc', 'dasf')remove(ctx, 'ga')cookie.set('adc', 'set-cookie-from-imperative-modify')