嵌套路由不起作用?

Nested routes don't work?

嗨,可爱的 Whosebugers,我正在使用 react@0.14.5 和 react-router@1.0.3(安装了 @latest)。

这个例子对我不起作用(如下)。当我导航到 http://mysite/about 或单击关于 link 时,将始终显示主页。

点击前

点击后

我通过删除嵌套结构(下面的代码)解决了这个问题,现在它按预期工作了。

我是不是用错了这个包?

渲染子(嵌套)路由时,您需要在父路由中包含 this.props.children 才能渲染子路由。

例如,将其放入应用程序的渲染方法中:

<div> {this.props.children} </div>