Skip to content
This repository was archived by the owner on Jul 19, 2019. It is now read-only.

Commit 6500530

Browse files
author
TsaiKoga
committed
Finish lesson 4: 嵌套路由,可以通过this.props.children局部渲染模板
1 parent 2509c5f commit 6500530

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

lessons/04-nested-routes/index.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ import Repos from './modules/Repos'
77

88
render((
99
<Router history={hashHistory}>
10-
<Route path="/" component={App}/>
11-
<Route path="/repos" component={Repos}/>
12-
<Route path="/about" component={About}/>
10+
<Route path="/" component={App}>
11+
<Route path="/repos" component={Repos}/>
12+
<Route path="/about" component={About}/>
13+
</Route>
1314
</Router>
1415
), document.getElementById('app'))

lessons/04-nested-routes/modules/App.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ export default React.createClass({
1010
<li><Link to="/about">About</Link></li>
1111
<li><Link to="/repos">Repos</Link></li>
1212
</ul>
13+
{/* add this(nested routes' components) */}
14+
{this.props.children}
1315
</div>
1416
)
1517
}

0 commit comments

Comments
 (0)