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

Commit 63d2423

Browse files
committed
working through active
1 parent 66d013c commit 63d2423

File tree

10 files changed

+45
-8
lines changed

10 files changed

+45
-8
lines changed

lessons/01-setting-up/modules/App.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ import React from 'react'
22

33
export default React.createClass({
44
render() {
5-
return <div>Hello, React Router!</div>
5+
return <div>Hello!</div>
66
}
77
})
Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11
import React from 'react'
22
import { render } from 'react-dom'
3+
import { Router, Route, hashHistory } from 'react-router'
34
import 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'))
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import React from 'react'
2+
3+
export default React.createClass({
4+
render() {
5+
return <div>About</div>
6+
}
7+
})
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import React from 'react'
2+
3+
export default React.createClass({
4+
render() {
5+
return <div>Repos</div>
6+
}
7+
})
Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,16 @@
11
import React from 'react'
2+
import { Link } from 'react-router'
23

34
export 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
})

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: 1 addition & 0 deletions
Original file line numberDiff line numberDiff 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
}

lessons/05-active-links/index.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.active {
2+
color: green;
3+
}

lessons/05-active-links/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
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>

lessons/05-active-links/modules/App.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff 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>

0 commit comments

Comments
 (0)