Closed chengr4 closed 1 year ago
I found a solution, though there may be a better one.
Instead of passing history
as an argument into the createRootReducer
function, I simply declare history
in the rootReducer
file as follows:
// rootReducer.js
import { combineReducers } from 'redux'
import { connectRouter } from 'connected-react-router'
import { createBrowserHistory } from 'history'
export const history = createBrowserHistory()
const createRootReducer = combineReducers({
router: connectRouter(history),
... // rest of your reducers
})
export default createRootReducer
Then, I am able to combine it with the solution from the link above and reset the states.
Thank you all anyway
I would like to clean all global states of Redux store and I found a solution here:
https://stackoverflow.com/a/35641992
But I have no confidence to achieve it together with
connected-react-rotuer
.Can anyone help me? Thanks in advance!