saga-cookie
v0.2.3
Published
redux-saga model for Cookie
Readme
Saga-Cookie ·

Use Cookie as Redux state. 🍪

Installation
npm install saga-cookieConfiguarition
Example
Usage
Render Cookie from Props
{props.cookie.hello}Dispatch Cookie
setCookie is just like React's setState
import { setCookie } from 'saga-cookie';
// set-cookie
dispatch(setCookie({
hello: 'hello',
}));
dispatch(setCookie((cookie) => {
return {
hello: cookie.hello + ' saga cookie!',
}
}, function () {
// callback
}));
// delete cookie
dispatch(setCookie({
hello: null,
}));Force Update
You should avoid to do manual operation to Cookies when using saga-cookie,
use forceUpdate to reload cookies from BOM
import { forceUpdate } from 'saga-cookie';// force saga-cookie update
dispatch(forceUpdate);