File tree Expand file tree Collapse file tree 4 files changed +18
-3
lines changed Expand file tree Collapse file tree 4 files changed +18
-3
lines changed Original file line number Diff line number Diff line change
1
+ .active {
2
+ color : green;
3
+ }
4
+
Original file line number Diff line number Diff line change 2
2
< html >
3
3
< meta charset =utf-8/ >
4
4
< title > My First React Router App</ title >
5
+ < link rel =stylesheet href =index.css >
5
6
< div id =app > </ div >
6
7
< script src ="bundle.js "> </ script >
7
8
Original file line number Diff line number Diff line change 1
1
import React from 'react'
2
- import { Link } from 'react-router '
2
+ import NavLink from './NavLink '
3
3
4
4
export default React . createClass ( {
5
5
render ( ) {
6
6
return (
7
7
< div >
8
8
< h1 > React Router Tutorial</ h1 >
9
9
< ul role = "nav" >
10
- < li > < Link to = "/about" > About</ Link > </ li >
11
- < li > < Link to = "/repos" > Repos</ Link > </ li >
10
+ < li > < NavLink to = "/about" > About</ NavLink > </ li >
11
+ < li > < NavLink to = "/repos" > Repos</ NavLink > </ li >
12
12
</ ul >
13
13
{ this . props . children }
14
14
</ div >
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
+ } )
10
+
You can’t perform that action at this time.
0 commit comments