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 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 >
78
Original file line number Diff line number Diff line change 11import React from 'react'
2- import { Link } from 'react-router '
2+ import NavLink from './NavLink '
33
44export default React . createClass ( {
55 render ( ) {
66 return (
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 > < NavLink to = "/about" > About</ NavLink > </ li >
11+ < li > < NavLink to = "/repos" > Repos</ NavLink > </ li >
1212 </ ul >
1313 { this . props . children }
1414 </ 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