title: how to reset redux store when log out?
body: <p>I am trying to reset my storage when I log out but it doesn't seem to work at all.</p>
  
  <p>As you can see I am using AsyncStorage for my store and I try to follow the answer from <a href="https://stackoverflow.com/questions/35622588/how-to-reset-the-state-of-a-redux-store">this</a> post.</p>
  
  <p>Here is my index.js from store folder </p>
  
  <pre><code>import thunk from 'redux-thunk';
  import { createStore, compose, applyMiddleware } from 'redux';
  import { AsyncStorage } from 'react-native';
  import { persistStore, autoRehydrate } from 'redux-persist';
  import rootReducer from '../reducers';
  
  var defaultState = {};
  
  export function configureStore(initialState = defaultState) {
    var store = createStore(rootReducer, initialState, compose(
      applyMiddleware(thunk),
      autoRehydrate(),
    ));
    persistStore(store, { storage: AsyncStorage });
    return store;
  }
  </code></pre>
  
  <p>and here is my index.js from reducers folder</p>
  
  <pre><code>import { combineReducers } from 'redux';
  import { reducer as formReducer } from 'redux-form';
  import { AsyncStorage } from 'react-native';
  
  import authReducer from './authReducer';
  import alertsReducer from './alertsReducer';
  import jobsReducer from './jobsReducer';
  import userDataReducer from './userDataReducer';
  
  const appReducer = combineReducers({
    form: formReducer,
    auth: authReducer,
    alerts: alertsReducer,
    jobs: jobsReducer,
    userData: userDataReducer
  })
  
  const rootReducer = ( state, action ) =&gt; {
    if(action.type === 'UNAUTH_USER') {
      Object.keys(state).forEach(key =&gt; {
        AsyncStorage.removeItem(`persist:${key}`);
        console.log(state)
      });
    }
    return appReducer(state, action)
  }
  
  export default rootReducer
  </code></pre>