Skip to content

Redux-recovery is a redux-middleware that allows to persist, purge, rehydrate the store

License

Notifications You must be signed in to change notification settings

hajjiTarik/redux-recovery

Repository files navigation

alt tag

WIP

can be used for persist rehydrate, purge the application store,

build status

Why Redux-recovery

Today to benefit from all the features of redux is to have an SPA, so you have to provide a router. With redux-recovery one can take advantage of redux in a web page and do exactly what offers redux for a SPA. In addition, redux-recovery is simple to use, it has a simple and reliable approach.

Installation

To install the stable version:

npm install --save redux-recovery

This assumes you are using npm as your package manager.

Usage

import createStore from 'redux';
import ReduxRecovery from 'redux-recovery';

const reduxRecovery = new ReduxRecovery({
    recordAction: true,
    nbSavedActions: 10
});
const middlewares = [reduxRecovery.start];
const store = createStore(reducer, {...initialState}, 
  applyMiddleware(...middlewares),
));

API

Force state persistence:

store.dispatch({ type: 'PERSIST_STORE' });

Retrieve the persistence of the state:

reduxRecovery.getPersistState();

Purge persisted store:

reduxRecovery.getPersistState();

rehydrate the store:

reduxRecovery.getPersistState();

Licence

MIT

About

Redux-recovery is a redux-middleware that allows to persist, purge, rehydrate the store

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published