React project, click the browser back forward, the route is switched, but the navigation bar is not switched, how to deal with this?

make a website, header and footer are fixed, and the intermediate content is matched by route. The
code is as follows:
class App extends React.Component {

render () {

return (
  <div>
    <BackTop />
    <Layout className="layout">
      <Header className="header">
        <Headerc></Headerc>
      </Header>
      <Content className="content">
        <Switch>
          <Route
                 exact
                 path="/"
                 component={ Home } />
          <Route
                 path="/lab"
                 component={ Laboratory } />
          <Route
                 path="/hardware"
                 component={ Hardware } />
          <Route
                 path="/agricultural"
                 component={ Agricultural } />
          <Route
                 path="/service"
                 component={ Service } />
          <Route
                 exact
                 path="/diseases"
                 component={ Diseases } />
          <Route
                 path="/diseases/diseasesDetail/:id?"
                 component={ DiseasesDetail } />
          <Route
                 path="/aboutus"
                 component={ AboutUS } />
          <Route component={ Error } />
        </Switch>
      </Content>
      <Footer className="footer">
        <Footerc></Footerc>
      </Footer>
    </Layout>
  </div>
);

}
}

export default App;

the problem now is that when I switch the navigation menu, the route can be switched normally, but by clicking the return button of the browser, the route has been switched, and the highlight of the navigation bar menu has not changed. How to solve this?

May.22,2021
There is a withRouter function in

react-router to understand


that there is a problem with your navigation bar implementation
https://reacttraining.com/rea.

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3e3b3-2b943.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3e3b3-2b943.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?