Search code examples
reactjsreact-nativereduxreact-reduxredux-thunk

Delete or Reset redux thunk store completely while logout


I am using redux, react-redux and redux thunk for store management in my react native project, there is deferent reducers and actions. How I reset the entire store during logout

Is there any methods like createStore() to destroy a store? please share possible solutions

Thanks


Solution

  • The below solution worked for me,

    import reduxReset from 'redux-reset'
    
    const enHanceCreateStore = compose(
        applyMiddleware(thunk),
        reduxReset()  
      )(createStore)
    
    const store = enHanceCreateStore(reducers)
    

    dispatch reset action

    store.dispatch({
      type: 'RESET'
    })