React-router-dom second-level routing refresh will find the page.

import React, {Component} from "react";
import {BrowserRouter as Router,Route,Link,Switch,Redirect} from" react-router-dom";// introduces routing
import {Button} from "react-bootstrap";
import". / Home.css"
import HomeSection from". / HomeOne/HomeOne";
import HomeOneContext from". / HomeOneContext/HomeOneContext"

/ / this is a secondary route
class Home extends Component {

render() {
    return (
        <div>
            <Router>
                <div>
                    
                    <HomeSection />
                    <Switch>
                        <Route exact path="/" component={HomeOneContext}/>
                        <Route  path="/homeonecontext" component={HomeOneContext}/>
                    </Switch>
                </div>
            </Router>
        </div>
    );
}

}

export default Home;

this is my code

clipboard.png

clipboard.png

clipboard.png
I hope God can take a look at it for me

Mar.06,2021

BrowserRouter is equivalent to sending a request to the backend, which needs to be redirected to the index page


change the BrowserRouter mode to hash Mode. Or let the backend modify it with you to use BrowserRouter

reference:
official: ide.github.io/react-router-cn/docs/guides/basics/Histories.html" rel=" nofollow noreferrer "> https://react-guide.github.io.
blog: http://blog.codingplayboy.com.

Menu