2020.7.4-1 • Published 6 years ago
@grooveland/redux-storage v2020.7.4-1
@grooveland/redux-storage
Middleware to record status changes (Redux) and store them in the browser storage
DEPENDENCIES
@grooveland/redux-storage depends on redux.
Usage
yarn add @grooveland/redux-storageor
npm i --save @grooveland/redux-storageInside the file where your redux store is configured you must import the initializer
import { storage } from '@grooveland/redux-storage';Once imported you must configure the middleware and the pre-load function
const [preload, storageMiddleware] = storage({ type: 'session', key: 'grooveland' });Finally we only have to load the initial state of the application from the selected storage.
const initState = {
...preload(),
};and then we register the middleware inside the store
const composedEnhancers = compose(storageMiddleware);
export const store = createStore(reducer, composedEnhancers);The middleware registers all changes within our state and stores them in the selected storage.
API
Description of the properties available within the storage method
| Key | Type | Default | Description |
|---|---|---|---|
| type | StorageSettings | local | Type of storage used for data persistence |
| key | string | new Date().getTime() | storage access key |
StorageSettings
It only supports storage types such as local and session.
2020.7.4-1
6 years ago
2020.7.4
6 years ago
2020.7.4-a.5
6 years ago
2020.7.4-a.4
6 years ago
2020.7.4-a.3
6 years ago
2020.7.4-a.2
6 years ago
2020.7.4-a.1
6 years ago