When using React to develop a new project, when refreshing the page and directly accessing the secondary or tertiary routing, the access fails and a 404 or resource loading exception occurs. This article analyzes this problem and summarizes the solution. This article mainly introduces the solution to the 404 problem of react-router browserHistory refresh page. It is of great practical value. Friends in need can refer to it. I hope it can help everyone.
Background
When using webpack-dev-server as a local development server, under normal circumstances, you only need to simply use the webpack-dev-server command to start it. However, when the project is in the following two situations, nested routing and asynchronous loading routing are often required:
We use a routing library such as react-router to build single-page application routing;
Use the html-webpack-plugin plug-in to dynamically inject the