Hi, I just searched through the github issues to see how people are resetting their store but I didn't find anyone doing what I'm doing and so I ask here if this is ok or should be avoided.
Basically I saw issues like these: #63, #579 and instead of using flush() and purge() methods, I'm using directly the native method of the store I setted on redux-persist to clear everything up.
For example, in react-native with asyncstorage, when I need to delete everything, I just do:
AsyncStorage.clear()
I know this isn't always ok, you may be storing something else other than redux-persist stuff, but if it is ok for you, why don't use it?
UPDATE: With v5 I noticed this doesn't work anymore, why?
[redacted] - my comment was actually unrelated.
AsyncStorage.clear() will still clear v5 - but be warned it will clear all state, even that which does not belong to redux-persist.
I would definitely recommend using purge, it is well tested and both #63 and #579 were questions not bugs.
Basically you can either do
// method 1
import { purgeStoredState } from 'redux-persist'
purgeStoredState(persistConfig)
// method 2
persistor.purge()
Most helpful comment
AsyncStorage.clear()will still clear v5 - but be warned it will clear all state, even that which does not belong to redux-persist.I would definitely recommend using purge, it is well tested and both #63 and #579 were questions not bugs.
Basically you can either do