【发布时间】:2017-11-15 12:58:47
【问题描述】:
我正在尝试在我的一个组件中进行嵌套路由。
这是父组件:
const App = () => (
<BrowserRouter>
<Provider store={store}>
<Switch>
<Route exact path="/" component={Landing} />
<Route path="/contribute" component={Contribute} />
</Switch>
</Provider>
</BrowserRouter>
);
这是子组件:
const Landing = () => (
<div>
<SearchBar />
<section className="results-sctn">
<Route exact path="/" component={ArtistList} />
<Route path="/test" component={Test} />
</section>
</div>
);
ArtistList 在 / 路由上呈现良好,但 /test 呈现完全空白的页面。知道为什么会这样吗?
【问题讨论】:
标签: reactjs react-router react-router-v4 react-router-dom