i have a two reducers one is for authentication and second is for fetching some list of data. when i log out from app, my authentication reducer gets reinitialize but i don't know how to reinitialize my second reducer as well at the time of logging out.
here is my combine reducers code:
export default combineReducers({
auth: AuthReducer,
patientReducer: PatientReducer,
});
then import my reducers in app.js:
import reducers from './reducers';
class App extends Component {
render() {
const store = createStore(reducers,{},applyMiddleware(ReduxThunk));
return (
<Provider store={store}>
<RouterComponent />
</Provider>
);
}
}
export default App;
please tell me if how to dispatch an action of log out so that both of my reducers get reinitialize/empty.
because whenever i log out and then log in from another account the app first renders the previous user's data list because my second reducer(patientReducer) doesn't get reinitialize/empty at the time of logging out and then re-renders the data list of the current logged in user.