This repository was archived by the owner on Jul 19, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 10 files changed +45
-8
lines changed
03-navigating-with-link/modules Expand file tree Collapse file tree 10 files changed +45
-8
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,6 @@ import React from 'react'
22
33export default React . createClass ( {
44 render ( ) {
5- return < div > Hello, React Router !</ div >
5+ return < div > Hello!</ div >
66 }
77} )
Original file line number Diff line number Diff line change 11import React from 'react'
22import { render } from 'react-dom'
3+ import { Router , Route , hashHistory } from 'react-router'
34import App from './modules/App'
4- render ( < App /> , document . getElementById ( 'app' ) )
5+
6+ render ( (
7+ < Router history = { hashHistory } >
8+ < Route path = "/" component = { App } />
9+ < Route path = "/repos" component = { Repos } />
10+ < Route path = "/about" component = { About } />
11+ </ Router >
12+ ) , document . getElementById ( 'app' ) )
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 < div > About</ div >
6+ }
7+ } )
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 < div > Repos</ div >
6+ }
7+ } )
Original file line number Diff line number Diff line change 11import React from 'react'
2+ import { Link } from 'react-router'
23
34export default React . createClass ( {
45 render ( ) {
5- return < div > Hello, React Router!</ div >
6+ return (
7+ < div >
8+ < h1 > Hello, React Router!</ h1 >
9+ < ul role = "nav" >
10+ < li > < Link to = "/about" > About</ Link > </ li >
11+ < li > < Link to = "/repos" > Repos</ Link > </ li >
12+ </ ul >
13+ </ div >
14+ )
615 }
716} )
Original file line number Diff line number Diff line change @@ -7,8 +7,9 @@ import Repos from './modules/Repos'
77
88render ( (
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' ) )
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ export default React.createClass({
1010 < li > < Link to = "/about" > About</ Link > </ li >
1111 < li > < Link to = "/repos" > Repos</ Link > </ li >
1212 </ ul >
13+ { this . props . children }
1314 </ div >
1415 )
1516 }
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 11<!doctype html public "storage">
22< html >
3+ < link rel ="stylesheet " href ="index.css " />
34< meta charset =utf-8/ >
45< title > My First React Router App</ title >
56< div id =app > </ div >
Original file line number Diff line number Diff line change @@ -7,8 +7,8 @@ export default React.createClass({
77 < div >
88 < h1 > React Router Tutorial</ h1 >
99 < ul role = "nav" >
10- < li > < Link to = "/about" > About</ Link > </ li >
11- < li > < Link to = "/repos" > Repos</ Link > </ li >
10+ < li > < Link to = "/about" activeClassName = "active" > About</ Link > </ li >
11+ < li > < Link to = "/repos" activeClassName = "active" > Repos</ Link > </ li >
1212 </ ul >
1313 { this . props . children }
1414 </ div >
You can’t perform that action at this time.
0 commit comments