在React Router中的嵌套路由中刷新后看到空白页

问题描述 投票:1回答:1

这是我在App.js中的主要路由器页面:

<Provider store={store}>
    <Router>
        <Switch>
            <Route exact path = "/" component= {FormPage}></Route>
            <Route  path = "/dashboard" component= {Dashboard}></Route>
        </Switch>
    </Router>
</Provider>

并且在仪表板页面:

<Router>
    <Switch>
        <Route  path = "/register" component= {Registration}></Route>
        <Route  path = "/home" component= {Home}></Route>
    </Switch>
</Router>

在注册或主页中刷新后,没有任何显示。但是App.js文件中的路由工作正常。

reactjs react-router
1个回答
0
投票
   <Router>
       <Switch>
          <Route  path = "/dashboard/register" component= {Registration}> 
          </Route>
          <Route  path = "/dashboard/home" component= {Home}></Route>
      </Switch>
    </Router>
© www.soinside.com 2019 - 2024. All rights reserved.