Home > Web Front-end > JS Tutorial > body text

How to solve react-router browserHistory refresh page 404 problem

小云云
Release: 2017-12-29 16:18:34
Original
3409 people have browsed it

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:

  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