You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import{createFilter,createBlacklistFilter}from'redux-persist-transform-filter';// this works too:importcreateFilter,{createBlacklistFilter}from'redux-persist-transform-filter';// you want to store only a subset of your state of reducer oneconstsaveSubsetFilter=createFilter('myReducerOne',['keyYouWantToSave1','keyYouWantToSave2']);// you want to remove some keys before you saveconstsaveSubsetBlacklistFilter=createBlacklistFilter('myReducerTwo',['keyYouDontWantToSave1','keyYouDontWantToSave2']);// you want to load only a subset of your state of reducer threeconstloadSubsetFilter=createFilter('myReducerThree',null,['keyYouWantToLoad1','keyYouWantToLoad2']);// saving a subset and loading a different subset is possible// but doesn't make much sense because you'd load an empty stateconstsaveAndloadSubsetFilter=createFilter('myReducerFour',['one','two']['three','four']);constpredicateFilter=persistFilter('form',[{path: 'one',filterFunction: (item: any): boolean=>item.mustBeStored},{path: 'two',filterFunction: (item: any): boolean=>item.mustBeStored},],'whitelist')constnormalPathFilter=persistFilter('form',['one','two'],'whitelist')persistStore(store,{transforms: [saveSubsetFilter,saveSubsetBlacklistFilter,loadSubsetFilter,saveAndloadSubsetFilter,]});
Example project
git clone https://github.com/edy/redux-persist-transform-filter-example.git
cd redux-persist-transform-filter-example
npm install
npm start