Open ravimantra opened 5 years ago
I need to clear store on onClick event. Below is my "configureStore".
const persistedReducer = persistReducer(persistConfig, rootReducer(history));
export default function configureStore (preloadedState) { const store = createStore( persistedReducer, // root reducer with router state preloadedState, compose( applyMiddleware( routerMiddleware(history), // for dispatching history actions thunk, reduxImmutableStateInvariant(), logger ) ) ) const persistor = persistStore(store) return { store, persistor } }
You can, for example, try to pass the persistor along with the store down to the components tree. Then inside onClick event use persistor's purge method, which dispatches PURGE action.
I need to clear store on onClick event. Below is my "configureStore".
const persistedReducer = persistReducer(persistConfig, rootReducer(history));
export default function configureStore (preloadedState) { const store = createStore( persistedReducer, // root reducer with router state preloadedState, compose( applyMiddleware( routerMiddleware(history), // for dispatching history actions thunk, reduxImmutableStateInvariant(), logger ) ) ) const persistor = persistStore(store) return { store, persistor } }