Skip to content

redux middleware for recording redux actions for a particular session to session storage

License

Notifications You must be signed in to change notification settings

conorhastings/redux-session-storage

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Redux Session Storage

A redux middleware for storing redux actions in sessionStorage

Args

  • key - key to store JSON array of actions as in sessionStorage
  • transform - a function to transform action before storing Note : I reccomend using Object.assign or something similar before doing any modifcation to the data as this could adverse effects on your application. the data returned here will not be the action that is passed to next, the action that comes in will be passed, but as this is a plain object and not immutable, modifcations will have side effects. The transform function receives the action as it's first argument and getState as the second
  • limit - a limit on the number of items to store, defaults to no limit

Use

import reduxSessionStorage from "redux-session-storage";
const sesionStorageRecord = reduxSessionStorage({key: "myKey"});
const createStoreWithMiddleware = applyMiddleware(sessionStorageRecord)(createStore);

Other Functions

We also include a function getActions(key) that will return an array of stored actions.

Install

npm i redux-session-storage --save

About

redux middleware for recording redux actions for a particular session to session storage

Resources

License

Stars

Watchers

Forks

Packages

No packages published