Home > Web Front-end > JS Tutorial > 404 problem occurs when refreshing the page in react-router

404 problem occurs when refreshing the page in react-router

亚连
Release: 2018-06-14 15:51:34
Original
2177 people have browsed it

This article mainly introduces the solution to the 404 problem of react-router browserHistory refreshing the page. It is of great practical value. Friends in need can refer to it.

When using React to develop new projects, when encountering the refresh page, directly When accessing the secondary or tertiary route, the access fails and a 404 or resource loading exception occurs. This article analyzes this problem and summarizes the solution.

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, but when the project In the following two situations, nested routing and asynchronous loading of routes are often required:

  1. We use a routing library such as react-router to build single-page application routing;

  2. Use the html-webpack-plugin plug-in to dynamically inject the

Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template