rt2zz / redux-persist

persist and rehydrate a redux store
MIT License
12.95k stars 866 forks source link

persistReducer expecting object of transformers,key and storage #545

Open nikhil4326 opened 6 years ago

nikhil4326 commented 6 years ago

As per documentation, we can use persistReducer method with first argument as object of transformers array. Like below. const reducer = persistReducer({transforms: [myTransform]}, baseReducer)

BUT, persistReducer expecting object with key, stoarge and array of transformers. like below:


const configPersist = {
  key: 'root',
  storage,
  transforms: [encryptor]
}
const reducer = persistReducer(configPersist, appReducer)

I have already provided config object to persistCombineReducers method. check below:

const config = {
  key: 'root',
  storage,
}
const Reducer = persistCombineReducers(config, { Reducer1,Reducer2,...});

Question: is there any thing wrong with my implemetation? If no: Documentation needs to be update.

I think persistReducer should not ask for config object with key and stoarge. As I have already provided to persistCombineReducers method.

Thanks

rt2zz commented 6 years ago

Yes I think there is some confusion and I am all ears for how to clear it up. If you use persistCombineReducers you should not need to also use persistReducer. They basically do the same thing under the hood, just with slightly different reconciliation strategies.