Javascript react路由器dom v5不呈现子级
我尝试了很多在互联网上和官方文档中看到的技巧,比如有或没有“精确”,其他类型的语法,但没有一种能让我解开这个谜团 但是,问题是为什么第二个路由器不显示其组件Javascript react路由器dom v5不呈现子级,javascript,reactjs,nested,rendering,react-router-dom,Javascript,Reactjs,Nested,Rendering,React Router Dom,我尝试了很多在互联网上和官方文档中看到的技巧,比如有或没有“精确”,其他类型的语法,但没有一种能让我解开这个谜团 但是,问题是为什么第二个路由器不显示其组件 //index.js ReactDOM.render( <Provider store={createStoreWithMiddleware( reducers, window.__REDUX_DEVTOOLS_EXTENSION__ &&
//index.js
ReactDOM.render(
<Provider
store={createStoreWithMiddleware(
reducers,
window.__REDUX_DEVTOOLS_EXTENSION__ &&
window.__REDUX_DEVTOOLS_EXTENSION__()
)}
>
<BrowserRouter>
<App />
</BrowserRouter>
</Provider>,
document.getElementById('root')
);
//index.js
ReactDOM.render(
,
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>
//app.js
} />
[...]
} />
带有第二个路由器的Profil页面,该路由器不呈现组件
<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>
//当我进入这一页时,我看到下面的路线
从上面的列表中选择一部电影}/>
//但在我按F5实现页面之前,此路径不会呈现
} />