Browse Source

Lesson 07 Final

Ryan Florence 9 years ago
parent
commit
ee1ee5305d
2 changed files with 7 additions and 5 deletions
  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((
 render((
   <Router history={hashHistory}>
   <Router history={hashHistory}>
     <Route path="/" component={App}>
     <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 path="/about" component={About}/>
     </Route>
     </Route>
   </Router>
   </Router>

+ 4 - 3
modules/Repos.js

@@ -1,5 +1,5 @@
 import React from 'react'
 import React from 'react'
-import { Link } from 'react-router'
+import NavLink from './NavLink'
 
 
 export default React.createClass({
 export default React.createClass({
   render() {
   render() {
@@ -7,9 +7,10 @@ export default React.createClass({
       <div>
       <div>
         <h2>Repos</h2>
         <h2>Repos</h2>
         <ul>
         <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>
         </ul>
+        {this.props.children}
       </div>
       </div>
     )
     )
   }
   }