How to write react-router nested route?

as shown in the figure, the project enters Main component by default. Main has four sub-components. Through footer switching, the default display is Msite component . The route of react is really difficult to understand, and there is a problem with how to write it

.
// Main
render(){
    return (
      <div>
        <div><Link to="/">msite</Link></div>
        <div><Link to="/discover">discover</Link></div>
        <div><Link to="/order">order</Link></div>
        <div><Link to="/user">user</Link></div>
        
        
        <Route path="" component={Msite}/>
        <Route path="/discover" component={Discover}/>
        <Route path="/order" component={Order}/>
        <Route path="/user" component={User}/>
      </div>
    )
  }
// App
    return (
      <Router history={history} >
        <div className="App">
            <Switch>
              <Route  path="/" component={Main}/>
              <Route path="/search" component={Search} />
              <Route path="/address" component={Address} />
            </Switch>
        </div>
      </Router>
    );

clipboard.png

Mar.31,2021

resolved

export default class MainPage extends React.Component {
  render(){
    return (
      <div>this is MainPage.jsx
        <div><Link to='/msite'>msite</Link></div>
        <div><Link to='/discover'>discover</Link></div>
        <div><Link to='/order'>order</Link></div>
        <div><Link to='/user'>user</Link></div>
        
        <Switch>
          <Route path='/discover' component={Discover}/>
          <Route path='/order' component={Order}/>
          <Route path='/user' component={User}/>
          <Route  component={Msite}/>
        </Switch>
      </div>
    )
  }
}
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-1be6d99-31844.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-1be6d99-31844.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?