瀏覽代碼

Lesson 07 Final

Ryan Florence 9 年之前
父節點
當前提交
ee1ee5305d
共有 2 個文件被更改,包括 7 次插入5 次删除
  1. 3 2
      index.js
  2. 4 3
      modules/Repos.js

+ 3 - 2
index.js

@@ -9,8 +9,9 @@ import Repo from './modules/Repo'
 render((
   <Router history={hashHistory}>
     <Route path="/" component={App}>
-      <Route path="/repos" component={Repos}/>
-      <Route path="/repos/:userName/:repoName" component={Repo}/>
+      <Route path="/repos" component={Repos}>
+        <Route path="/repos/:userName/:repoName" component={Repo}/>
+      </Route>
       <Route path="/about" component={About}/>
     </Route>
   </Router>

+ 4 - 3
modules/Repos.js

@@ -1,5 +1,5 @@
 import React from 'react'
-import { Link } from 'react-router'
+import NavLink from './NavLink'
 
 export default React.createClass({
   render() {
@@ -7,9 +7,10 @@ export default React.createClass({
       <div>
         <h2>Repos</h2>
         <ul>
-          <li><Link to="/repos/rackt/react-router">React Router</Link></li>
-          <li><Link to="/repos/facebook/react">React</Link></li>
+          <li><NavLink to="/repos/rackt/react-router">React Router</NavLink></li>
+          <li><NavLink to="/repos/facebook/react">React</NavLink></li>
         </ul>
+        {this.props.children}
       </div>
     )
   }