redux-store-cleaner

1.0.2 • Public • Published

redux-state-cleaner

License: MIT

Easily reset your reducers to the initial state with only one action

Installation

npm i redux-store-cleaner -S

Features

  • Reset store branches by sending 'undefined' in its reducers
  • Clean specific reducer with namespace

Usage

Wrap your reducer with withStoreCleaner function

import withStoreCleaner from 'redux-store-cleaner';
 
const someFancyReducer = (state, action) => { /* Impl */ };
 
export default withStoreCleaner(someFancyReducer, 'someFancyReducerNamespace');

and call cleanStore wherever you want

import { cleanStore } from 'redux-store-cleaner';
import { store } from './store';
 
store.dispatch(cleanStore('someFancyReducerNamespace'));
// You can also clean all stores with omitting namespace
// store.dispatch(cleanStore('));

License

MIT © Andrew Paramoshkin

Package Sidebar

Install

npm i redux-store-cleaner

Weekly Downloads

2

Version

1.0.2

License

none

Unpacked Size

6.17 kB

Total Files

9

Last publish

Collaborators

  • paramoshkinandrew