For the sake of helping future souls with this issue, it turns out that according to the linked github discussions, that version 5.0 of the history
package is causing the issue and downgrading to version 4.10.1 solves the problem for me.
npm install [email protected]
https://github.com/ReactTraining/history/issues/803
https://github.com/ReactTraining/history/issues/804
Add router
in your reducer with using connectRouter
and history
Refer this link
https://www.npmjs.com/package/connected-react-router
import { connectRouter } from 'connected-react-router'
const rootReducer = combineReducers({
login: loginReducer,
router: connectRouter(history),
});
The main issue is the version of the history package, with react-router-dom v5 you need to use history v4 (the latest version of which is 4.10.1) - history v5 is only compatible with react-router-dom v6.
You have forgotten :
router: connectRouter(history),
in your combineReducers()
If you use immutable
you should import ConnectedRouter
from 'connected-react-router/immutable'.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With