The redux-persist library provides ways to store redux state tree into some sorts of storage, and rehydrate when app is re-opened.
I see the need of restoring the state tree because it contains useful data, but the library also includes a feature for persisting reducers.
const persistedReducer = persistReducer(persistConfig, rootReducer)
I cannot quite understand the motivation behind since I believe reducers are just functions to mutate the state. Those are well-defined in the code, compared to dynamic data in state tree.
When should we persist reducer? Any example showing why it is helpful?
persistReducer"returns an enhanced reducer". I guess this means that it wraps your reducer into a function that will persist the new state for you automatically. - Al.G.