An error was reported after upgrading the third-party dependency package in the react project. Kneel and beg the boss for an answer.

background:

recently, when I took over a new project, due to the older dependency packages used in the new project, many versions of the dependency packages were no longer maintained, so in order to develop better in the future, I upgraded the dependency packages such as react, react-router, react-dom, react-hot-loader, redux and so on. After two days, I was still stumped by a problem. Get down on your knees and beg the boss for an answer, or help find the wrong answer.

console error message:

stackoverflow:https://stackoverflow.com/que...

:


:

index.js:


Root.js:


routeConfig.js


rootReducer.js


configStore.js


Home.js


Home.js index.js


Home.js route.js


App.js


Mar.18,2021

back version there are too many updates


the usage of react-hot-loader has changed. Instead of using if (hot.module) {} form


suggest going back and keeping the version unchanged, just React-router upgrading is enough for you to do


Thank you for your suggestions. Has been solved, the main reason is the react-hot-loader AppContainer problem, the project uses the V4 version, after reading its README, found that the V4 version is no longer using AppContainer. Then there was a problem with Uncaught TypeError: Cannot read property 'pathname' of undefined, which was found to be the problem of using react-router-redux 's ConnectedRouter components. Then decisively use react-router-dom 's BrowserRouter as Router, to solve the problem.

Menu