File tree Expand file tree Collapse file tree 4 files changed +36
-2
lines changed
lessons/02-rendering-a-route Expand file tree Collapse file tree 4 files changed +36
-2
lines changed Original file line number Diff line number Diff line change 1
1
import React from 'react'
2
2
import { render } from 'react-dom'
3
3
import App from './modules/App'
4
- render ( < App /> , document . getElementById ( 'app' ) )
4
+ import { Router , Route , hasHistory } from 'react-router' ;
5
+ import About from './modules/About'
6
+ import Repos from './modules/Repos'
7
+
8
+ render ( (
9
+ < Router history = { hasHistory } >
10
+ < Route path = "/" component = { App } />
11
+ < Route path = "/repos" component = { Repos } />
12
+ < Route path = "/about" component = { About } />
13
+
14
+ </ Router >
15
+ ) , 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
1
import React from 'react'
2
+ import { Link } from 'react-router'
2
3
3
4
export default React . createClass ( {
4
5
render ( ) {
5
- return < div > Hello, React Router!</ div >
6
+ return (
7
+ < div >
8
+ < h1 > React Router Tutorial</ 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
+ )
6
15
}
7
16
} )
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
+ } )
You can’t perform that action at this time.
0 commit comments