2.3.10 • Published 5 years ago

react-off-the-grid v2.3.10

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

React-Off-The-Grid

Unopinionated component that stores your redux store in local storage.

Install

Usage

create the store and provide an instance of it to the component

 <OfflineMode saveName="MOOSE_FILE" store={ store } />

typical example:

const store = createStore(reducers);
ReactDOM.render(
  <div>
    <OfflineMode saveName="MOOSE_FILE" store={ store } />
    <Provider store={ store }>
      <App/>
   </Provider>
  </div>, document.getElementById('root'));

Thats it, your application will now save to local storage whenever the redux store changes

props

saveName - The name of the save file in local storage store - the redux store comparisonFunction - If the baked in shallow comparison function doesn't do it for you (compares by simple type and references), you can provide your own as a prop, it must return a true or false, which is then used to determine if the component should save the current store state

When saving, the offline mode will add the key _lastModified to the object for comparisons.

Offline mode will attempt to load from local storage if the second level store object is empty. if it finds anything using the save name, it will dispatch an action with the type: LOAD_FROM_LOCAL_STORAGE

You can utilize this to load in data from storage

2.3.10

5 years ago

2.3.9

5 years ago

2.3.8

5 years ago

2.3.7

5 years ago

2.3.6

5 years ago

2.3.5

5 years ago

2.3.4

5 years ago

2.3.3

5 years ago

2.3.2

5 years ago

2.3.1

5 years ago

2.3.0

5 years ago

2.2.0

5 years ago

2.1.1

5 years ago

2.1.0

5 years ago

2.0.0

5 years ago

1.2.0

5 years ago

1.1.0

5 years ago

1.0.0

5 years ago