如何解决反应路由器dom v5不渲染孩子
我尝试了很多在互联网上以及在React Router dom的官方文档中看到的技巧,例如带有或不带有“精确”,其他类型的语法,但没有一个能让我解决这个谜。 >
但是,问题是为什么第二个路由器不显示其组件?
//index.js
ReactDOM.render(
<Provider
store={createStoreWithMiddleware(
reducers,window.__REDUX_DEVTOOLS_EXTENSION__ &&
window.__REDUX_DEVTOOLS_EXTENSION__()
)}
>
<BrowserRouter>
<App />
</BrowserRouter>
</Provider>,document.getElementById('root')
);
来自app.js的主路由器,运行正常。
//app.js
<Router>
<TransitionGroup>
<Switch location={location}>
<Route exact path="/" render={() => <HomeView handleClick={handleClick} />} />
[...]
<Route path="/Profil" render={() => <ProfilView />} />
</Switch>
</TransitionGroup>
</Router>
带有第二个不渲染组件的路由器的配置文件页面
<Row>
<Col xs={2} className='justify-content-center'>
<GroupBouton />
</Col>
<Col xs={10} className=''>
<Switch location={location}>
//when I go to this page I see the route below
<Route exact path={path} render={() => <h3>Choose a movie from the list above </h3>} />
//But this route is not rendering till I actualise the page by pushing F5
<Route path={`${path}/Myprofil`} render={() => <Myprofil />} />
</Switch>
</Col>
</Row>
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。