redux-state-local-browser-sync

1.0.2 • Public • Published

redux-state-local-browser-sync

NPM JavaScript Style Guide

A plugin which persists your redux state across local browsers.

Simple configuration steps yet powerful plugin.

demo

Install

npm install --save redux-state-local-browser-sync

Basic Usage

  • Configure redux-persist in your project.

  • Import redux-state-local-browser-sync.

  • Pass in persistConfig and store as props to the imported name of the redux-state-local-browser-sync

Configure redux-persist.

import { createStore } from 'redux'
import { persistStore, persistReducer } from 'redux-persist'
import storage from 'redux-persist/lib/storage' // defaults to localStorage for web
 
import rootReducer from './reducers'
 
const persistConfig = {
  key: 'root',
  storage,
}
 
const persistedReducer = persistReducer(persistConfig, rootReducer)
 
export default () => {
  let store = createStore(persistedReducer)
  let persistor = persistStore(store)
  return { store, persistor }
}

Import redux-state-local-browser-sync and pass persistConfig and store as props

 
import { createStore } from 'redux'
import { persistStore, persistReducer } from 'redux-persist'
import storage from 'redux-persist/lib/storage' 
import rootReducer from './reducers'
import localTabReduxStateChanger from "redux-state-local-browser-sync"; //import redux-state-local-browser-sync
 
 
const persistConfig = {
  key: 'root',
  storage,
}
 
const persistedReducer = persistReducer(persistConfig, rootReducer)
 
export default () => {
  let store = createStore(persistedReducer)
  let persistor = persistStore(store)
 
  localTabReduxStateChanger(persistConfig,store)  //pass persistConfig and store
  
  return { store, persistor }
}

License

MIT © ashwinKumar0505

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.2
    1
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.2
    1
  • 1.0.1
    0
  • 1.0.0
    0

Package Sidebar

Install

npm i redux-state-local-browser-sync

Weekly Downloads

1

Version

1.0.2

License

MIT

Unpacked Size

78.7 kB

Total Files

6

Last publish

Collaborators

  • ashwinkumar0505