在 react-router v2 中,我们可以做
// inside of routes.js
export default (
<Route path="/" component={App}>
<IndexRoute component={PostsIndex} />
<Route path="/posts/new" component={PostsNew} />
<Route path="/posts/:id" component={PostsShow} />
</Route>
);
然后在 App 容器内显示正确的子项:
// inside app.js
{this.props.children}
但在 react-router v4 中,{this.props.children}
不再起作用。是用另一种方式完成的吗?