【发布时间】:2015-07-16 22:39:20
【问题描述】:
我正在玩 reactjs 路由。在所有示例中,路由总是嵌套的,例如
<Route path="/" handler={App} >
<Route name="about" handler={About} />
<Route name="contact" handler={Contact} />
</Route>
是否可以有简单的非嵌套路由,如下所示?
<Route path="/" handler={App} />
<Route name="about" handler={About} />
<Route name="contact" handler={Contact} />
更新:
var routes = (
<Route name="root" handler={Root}>
<Route path="/" handler={Home} />
<Route path="/home" handler={Home} />
<Route path="/about" handler={About} />
<Route path="/projects" handler={Projects} />
<Route path="/contact" handler={Contact} />
</Route>
);
按照以下答案的建议更新到此之后,出现了奇怪的问题。 name 不再工作只有path 工作?我不得不更新我的路线。任何的想法?
【问题讨论】:
标签: reactjs react-router