0.2.3 • Published 5 years ago

saga-cookie v0.2.3

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

Saga-Cookie · GitHub license npm version Coverage Status PRs Welcome

Use Cookie as Redux state. 🍪

Workflow

Installation

npm install saga-cookie

Configuarition

Example

Examples

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);
0.2.3

5 years ago

0.2.2

5 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.0

5 years ago