# redux-stash

> Persist and rehydrate parts or all of your Redux store.

Latest version **1.2.0** (published 2020-12-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install redux-stash
pnpm add redux-stash
yarn add redux-stash
bun add redux-stash
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.0 |
| Published | 2020-12-19 |
| First published | 2018-09-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 33.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Jacob Buck |
| Maintainers | jacobbuck |
| Keywords | redux, middleware, persist, rehydrate, storage, localstorage, sessionstorage |

## Links

- npm: https://www.npmjs.com/package/redux-stash
- Repository: https://github.com/jacobbuck/redux-stash
- Homepage: https://github.com/jacobbuck/redux-stash#readme
- Issues: https://github.com/jacobbuck/redux-stash/issues
- npm.io page: https://npm.io/package/redux-stash

## Dependencies (1)

- [@babel/runtime](https://npm.io/package/@babel/runtime.md) ^7.12.5

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 1.2.0 (latest) — 2020-12-19
- 1.1.0 — 2020-07-24
- 1.0.1 — 2020-07-24
- 1.0.0 — 2020-07-10
- 0.2.0 — 2020-03-08
- 0.1.3 — 2019-06-02
- 0.1.2 — 2019-02-24
- 0.1.1 — 2018-09-26
- 0.1.0 — 2018-09-25
- 0.0.3 — 2018-09-25
- 0.0.2 — 2018-09-25
- 0.0.1 — 2018-09-24

## README

# redux-stash

Persist and rehydrate parts or all of your Redux store.

## Getting started

Install with your favourite package manager:

```sh
npm install --save redux-stash
```

## Usage

```js
import { applyMiddleware, createStore } from 'redux';
import {
  REHYDRATE,
  createStash,
  createStashMiddleware,
  rehydrateStore,
  LocalStorage,
} from 'redux-stash';

const reducer = (state = { foo: '' }, action) => {
  switch (action.type) {
    case REHYDRATE:
      return {
        ...state,
        foo: action.payload.foo
      };
    default:
      return state;
  }
};

const stashMiddleware = createStashMiddleware(
  createStash({
    name: 'foo',
    selector: state => state.foo,
    storage: new LocalStorage('foo'),
  });
);

const store = createStore(rootReducer, applyMiddleware(stashMiddleware));

rehydrateStore(store);
```

---
_Source: https://npm.io/package/redux-stash · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
