1.0.9 • Published 3 years ago

local-redux-storage v1.0.9

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

Local Redux Storage

NPM version Dependency Status devDependency Status

NPM

Simple, small and dependency free redux state to local storage on reduce layer.

Installation

npm i local-redux-storage

Usage

For all state.

import { createStore, combineReducers } from 'redux';
import storage from 'local-redux-storage';

const rootReducer = combineReducers({ ...reducers })

const store = createStore(storage(rootReducer))

For one reducer state.

import { createStore, combineReducers } from 'redux';
import storage from 'local-redux-storage';

const exampleReducer = (state = {}, action) => state

const reducer = storage(exampleReducer, 'exampleReducerKey')

const rootReducer = combineReducers({ 
    reducer,
    ...otherReducers 
})

const store = createStore(storage(rootReducer))

Example

Example project in example folder. Also live on https://local-redux-storage-example.netlify.app/.

License

ISC