File tree Expand file tree Collapse file tree 9 files changed +105
-2
lines changed Expand file tree Collapse file tree 9 files changed +105
-2
lines changed Original file line number Diff line number Diff line change 1+ .active {
2+ color : green;
3+ }
Original file line number Diff line number Diff line change 22< html >
33< meta charset =utf-8/ >
44< title > My First React Router App</ title >
5+ < link rel ="stylesheet " href ="index.css " />
56< div id =app > </ div >
67< script src ="bundle.js "> </ script >
Original file line number Diff line number Diff line change 1+ import { Router , Route , hashHistory } from 'react-router'
12import React from 'react'
23import { render } from 'react-dom'
34import App from './modules/App'
4- render ( < App /> , document . getElementById ( 'app' ) )
5+ import About from './modules/About'
6+ import Repos from './modules/Repos'
7+ import Repo from './modules/Repo'
8+ import Sig from './modules/Sig'
9+
10+ render ( (
11+ < Router history = { hashHistory } >
12+ < Route path = "/" component = { App } >
13+ < Route path = "/repos" component = { Repos } />
14+ { /* add the new route */ }
15+ < Route path = "/repos/:userName/:repoName" component = { Repo } />
16+ < Route path = "/about" component = { About } />
17+ < Route path = "/about/:user/:sig" component = { Sig } />
18+ </ Route >
19+ </ Router >
20+ ) , document . getElementById ( 'app' ) )
Original file line number Diff line number Diff line change 1+ import React from 'react'
2+ import { Link } from 'react-router'
3+
4+ export default React . createClass ( {
5+ render ( ) {
6+ return (
7+ < div >
8+ < h2 > About</ h2 >
9+
10+ < ul >
11+ < li > < Link to = "/about/holla/force" > Holla</ Link > </ li >
12+ < li > < Link to = "/about/atcha/power" > Atcha</ Link > </ li >
13+ </ ul >
14+ </ div >
15+ )
16+ }
17+ } )
Original file line number Diff line number Diff line change 11import React from 'react'
2+ import { Link } from 'react-router'
3+ import NavLink from './NavLink'
24
35export default React . createClass ( {
46 render ( ) {
5- return < div > Hello, React Router!</ div >
7+ return (
8+ < div >
9+ < h1 > Ghettohub Issues</ h1 >
10+ < ul role = "nav" >
11+ < li > < NavLink to = "/about" > About</ NavLink > </ li >
12+ < li > < NavLink to = "/repos" > Repos</ NavLink > </ li >
13+ </ ul >
14+
15+ { /* add this */ }
16+ { this . props . children }
17+
18+ </ div >
19+ )
620 }
721} )
Original file line number Diff line number Diff line change 1+ // modules/NavLink.js
2+ import React from 'react'
3+ import { Link } from 'react-router'
4+
5+ export default React . createClass ( {
6+ render ( ) {
7+ return < Link { ...this . props } activeClassName = "active" />
8+ }
9+ } )
Original file line number Diff line number Diff line change 1+ import React from 'react'
2+
3+ export default React . createClass ( {
4+ render ( ) {
5+ return (
6+ < div >
7+ < h2 > { this . props . params . repoName } </ h2 >
8+ </ div >
9+ )
10+ }
11+ } )
Original file line number Diff line number Diff line change 1+ // modules/Repos.js
2+ import React from 'react'
3+ import { Link } from 'react-router'
4+ // ...
5+ export default React . createClass ( {
6+ render ( ) {
7+ return (
8+ < div >
9+ < h2 > Repos</ h2 >
10+
11+ { /* add some links */ }
12+ < ul >
13+ < li > < Link to = "/repos/reactjs/react-router" > React Router</ Link > </ li >
14+ < li > < Link to = "/repos/facebook/react" > React</ Link > </ li >
15+ </ ul >
16+
17+ </ div >
18+ )
19+ }
20+ } )
Original file line number Diff line number Diff line change 1+ import React from 'react'
2+
3+ export default React . createClass ( {
4+ render ( ) {
5+ return (
6+ < div >
7+ { /*<h2>{this.props.params.user}</h2>*/ }
8+ < h2 > { this . props . params . sig } </ h2 >
9+ </ div >
10+ )
11+ }
12+ } )
You can’t perform that action at this time.
0 commit comments