redux-cookie-persist
v1.0.0
Published
Redux cookie persister and middleware
Downloads
8
Maintainers
Readme
redux-cookie-persist
Redux cookie persister and middleware
Install
npm install --save redux-cookie-persist
Usage
middleware: [
reduxCookieMiddleware({
'ACTION_TYPE': {
reducerKey: 'STATE_SUBSET_PATH',
cookieKey: 'COOKIE_KEY'
},
})
],
enhancers: [
persistState({
[COOKIE_KEY]: 'STATE_SUBSET_PATH',
})
],
Example
import { persistState, reduxCookieMiddleware } from 'redux-cookie-persist'
reduxCookieMiddleware({
'session.setToken': {
reducerKey: 'session.token',
cookieKey: 'token'
},
})
persistState({
token: 'session.token',
})