Skip to content

Commit 18210f9

Browse files
author
ravikanth720
committed
update with some small changes
1 parent 78bb519 commit 18210f9

File tree

28 files changed

+91
-49
lines changed

28 files changed

+91
-49
lines changed

lessons/01-setting-up/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ up our project.
99
## Clone the Tutorial
1010

1111
```
12-
git clone https://github.com/reactjs/react-router-tutorial
12+
git clone <tutorial url>
1313
cd react-router-tutorial
1414
cd lessons/01-setting-up
1515
npm install

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, USA!</div>
66
}
77
})

lessons/02-rendering-a-route/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ render((
2525
```
2626

2727
Make sure your server is running with `npm start` and then visit
28-
[http://localhost:8080](http://localhost:8080)
28+
http://localhost:8080
2929

3030
You should get the same screen as before, but this time with some junk
3131
in the URL. We're using `hashHistory`--it manages the routing history
@@ -79,8 +79,8 @@ render((
7979
), document.getElementById('app'))
8080
```
8181

82-
Now visit [http://localhost:8080/#/about](http://localhost:8080/#/about) and
83-
[http://localhost:8080/#/repos](http://localhost:8080/#/repos)
82+
Now visit http://localhost:8080/#/about and
83+
http://localhost:8080/#/repos
8484

8585
---
8686

lessons/02-rendering-a-route/index.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,16 @@
11
import React from 'react'
22
import { render } from 'react-dom'
33
import App from './modules/App'
4-
render(<App/>, document.getElementById('app'))
4+
import Repos from './modules/Repos'
5+
import About from './modules/About'
6+
import { Router, Route, hashHistory } from 'react-router'
7+
8+
render((
9+
<Router history={hashHistory}>
10+
<Route path='/' component={App} >
11+
<Route path='/repos' component={Repos} />
12+
<Route path='/about' component={About} />
13+
</Route>
14+
15+
</Router>
16+
), 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: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,23 @@
1-
import React from 'react'
1+
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+
<h3>Hello, React Router!</h3>
9+
<ul>
10+
<li>
11+
<Link to="/repos" >Repos</Link>
12+
13+
</li>
14+
<li>
15+
<Link to="/about" activeStyle={{color: 'red'}}>About</Link>
16+
</li>
17+
</ul>
18+
19+
{this.props.children}
20+
</div>)
21+
622
}
723
})
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+
})

lessons/03-navigating-with-link/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ Lets create some navigation in our `App` component.
88

99
```js
1010
// modules/App.js
11-
import React from 'react'
1211
import { Link } from 'react-router'
1312

1413
export default React.createClass({
@@ -26,7 +25,7 @@ export default React.createClass({
2625
})
2726
```
2827

29-
Now visit [http://localhost:8080](http://localhost:8080) and click the links, click back, click
28+
Now visit http://localhost:8080/ and click the links, click back, click
3029
forward. It works!
3130

3231
---

lessons/05-active-links/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Let's see how it looks with inline styles, add `activeStyle` to your
1414
<li><Link to="/repos" activeStyle={{ color: 'red' }}>Repos</Link></li>
1515
```
1616

17-
Now as you navigate, the active link is red.
17+
How as you navigate, the active link is red.
1818

1919
## Active Class Name
2020

@@ -47,7 +47,7 @@ our `index.html`.
4747
## Nav Link Wrappers
4848

4949
Most links in your site don't need to know they are active, usually just
50-
primary navigation links need to know. It's useful to wrap those so you
50+
primary navigation links need to know. Its useful to wrap those so you
5151
don't have to remember what your `activeClassName` or `activeStyle` is
5252
everywhere.
5353

lessons/06-params/README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
Consider the following urls:
44

55
```
6-
/repos/reactjs/react-router
6+
/repos/rackt/react-router
77
/repos/facebook/react
88
```
99

1010
These urls would match a route path like this:
1111

1212
```
13-
/repos/:userName/:repoName
13+
/repos/:userName/:repositoryName
1414
```
1515

1616
The parts that start with `:` are url parameters whose values will be
@@ -47,8 +47,9 @@ Now open up `index.js` and add the new route.
4747
import Repo from './modules/Repo'
4848

4949
render((
50-
<Router history={hashHistory}>
50+
<Router>
5151
<Route path="/" component={App}>
52+
<IndexRoute component={Home}/>
5253
<Route path="/repos" component={Repos}/>
5354
{/* add the new route */}
5455
<Route path="/repos/:userName/:repoName" component={Repo}/>
@@ -72,7 +73,7 @@ export default React.createClass({
7273

7374
{/* add some links */}
7475
<ul>
75-
<li><Link to="/repos/reactjs/react-router">React Router</Link></li>
76+
<li><Link to="/repos/rackt/react-router">React Router</Link></li>
7677
<li><Link to="/repos/facebook/react">React</Link></li>
7778
</ul>
7879

lessons/07-more-nesting/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ First, nest the `Repo` route under the `Repos` route. Then go render
2525
<div>
2626
<h2>Repos</h2>
2727
<ul>
28-
<li><Link to="/repos/reactjs/react-router">React Router</Link></li>
28+
<li><Link to="/repos/rackt/react-router">React Router</Link></li>
2929
<li><Link to="/repos/facebook/react">React</Link></li>
3030
</ul>
3131
{/* will render `Repo.js` when at /repos/:userName/:repoName */}
@@ -44,7 +44,7 @@ class name to these links:
4444
import NavLink from './NavLink'
4545

4646
// ...
47-
<li><NavLink to="/repos/reactjs/react-router">React Router</NavLink></li>
47+
<li><NavLink to="/repos/rackt/react-router">React Router</NavLink></li>
4848
// ...
4949
```
5050

lessons/07-more-nesting/modules/Repos.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export default React.createClass({
77
<div>
88
<h2>Repos</h2>
99
<ul>
10-
<li><Link to="/repos/reactjs/react-router">React Router</Link></li>
10+
<li><Link to="/repos/rackt/react-router">React Router</Link></li>
1111
<li><Link to="/repos/facebook/react">React</Link></li>
1212
</ul>
1313
</div>

lessons/08-index-routes/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ a route like `About` and `Repos` in the future. A few reasons include:
3535
1. Participating in a data fetching abstraction that relies on matched
3636
routes and their components.
3737
2. Participating in `onEnter` hooks
38-
3. Participating in code-splitting
38+
3. Participating in code-spliting
3939

4040
Also, it just feels good to keep `App` decoupled from `Home` and let the
4141
route config decide what to render as the children. Remember, we want to
@@ -69,7 +69,7 @@ render((
6969
), document.getElementById('app'))
7070
```
7171

72-
Now open [http://localhost:8080](http://localhost:8080) and you'll see the new component is
72+
Now open http://localhost:8080 and you'll see the new component is
7373
rendered.
7474

7575
Notice how the `IndexRoute` has no path. It becomes

lessons/08-index-routes/modules/Repos.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export default React.createClass({
77
<div>
88
<h2>Repos</h2>
99
<ul>
10-
<li><NavLink to="/repos/reactjs/react-router">React Router</NavLink></li>
10+
<li><NavLink to="/repos/rackt/react-router">React Router</NavLink></li>
1111
<li><NavLink to="/repos/facebook/react">React</NavLink></li>
1212
</ul>
1313
{this.props.children}

lessons/09-index-links/README.md

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,6 @@ index route is rendered.
2626
First lets use the `IndexLink`
2727

2828
```js
29-
// App.js
30-
import { IndexLink, Link } from 'react-router'
31-
32-
// ...
3329
<li><IndexLink to="/" activeClassName="active">Home</IndexLink></li>
3430
```
3531

@@ -42,18 +38,18 @@ We can use `Link` as well by passing it the `onlyActiveOnIndex` prop
4238
(`IndexLink` just wraps `Link` with this property for convenience).
4339

4440
```js
45-
<li><Link to="/" activeClassName="active" onlyActiveOnIndex={true}>Home</Link></li>
41+
<li><Link to="/" activeClassName="active" onlyActiveOnIndex>Home</Link></li>
4642
```
4743

4844
That's fine, but we already abstracted away having to know what the
4945
`activeClassName` is with `Nav`.
5046

51-
Remember, in `NavLink` we're passing along all of our props to `Link` with
47+
Remember, in `Nav` we're passing along all of our props to `Link` with
5248
the `{...spread}` syntax, so we can actually add the prop when we render
5349
a `NavLink` and it will make its way down to the `Link`:
5450

5551
```js
56-
<li><NavLink to="/" onlyActiveOnIndex={true}>Home</NavLink></li>
52+
<li><NavLink to="/" onlyActiveOnIndex>Home</NavLink></li>
5753
```
5854

5955
---

lessons/09-index-links/modules/Repos.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export default React.createClass({
77
<div>
88
<h2>Repos</h2>
99
<ul>
10-
<li><NavLink to="/repos/reactjs/react-router">React Router</NavLink></li>
10+
<li><NavLink to="/repos/rackt/react-router">React Router</NavLink></li>
1111
<li><NavLink to="/repos/facebook/react">React</NavLink></li>
1212
</ul>
1313
{this.props.children}

lessons/10-clean-urls/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { Router, Route, browserHistory, IndexRoute } from 'react-router'
2020
render((
2121
<Router history={browserHistory}>
2222
{/* ... */}
23-
</Router>
23+
<Router>
2424
), document.getElementById('app'))
2525
```
2626

lessons/10-clean-urls/modules/Repos.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export default React.createClass({
77
<div>
88
<h2>Repos</h2>
99
<ul>
10-
<li><NavLink to="/repos/reactjs/react-router">React Router</NavLink></li>
10+
<li><NavLink to="/repos/rackt/react-router">React Router</NavLink></li>
1111
<li><NavLink to="/repos/facebook/react">React</NavLink></li>
1212
</ul>
1313
{this.props.children}

lessons/11-productionish-server/README.md

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ depending on the environment.
1212
Let's install a couple modules:
1313

1414
```
15-
npm install express if-env compression --save
15+
npm install if-env compression --save
1616
```
1717

1818
First, we'll use the handy `if-env` in `package.json`. Update your
@@ -31,11 +31,10 @@ Now when we run `npm start` it will check if our `NODE_ENV` is
3131
production. If it is, we run `npm run start:prod`, if it's not, we run
3232
`npm run start:dev`.
3333

34-
Now we're ready to create a production server with Express and add a new file at root dir. Here's a
34+
Now we're ready to create a production server with Express. Here's a
3535
first attempt:
3636

3737
```js
38-
// server.js
3938
var express = require('express')
4039
var path = require('path')
4140
var compression = require('compression')
@@ -58,14 +57,12 @@ app.listen(PORT, function() {
5857

5958
Now run:
6059

61-
```sh
60+
```
6261
NODE_ENV=production npm start
63-
# For Windows users:
64-
# SET NODE_ENV=production npm start
6562
```
6663

6764
Congratulations! You now have a production server for this app. After
68-
clicking around, try navigating to [http://localhost:8080/package.json](http://localhost:8080/package.json).
65+
clicking around, try navigating to `http://localhost:8080/package.json`.
6966
Whoops. Let's fix that. We're going to shuffle around a couple files and
7067
update some paths scattered across the app.
7168

lessons/11-productionish-server/modules/Repos.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export default React.createClass({
77
<div>
88
<h2>Repos</h2>
99
<ul>
10-
<li><NavLink to="/repos/reactjs/react-router">React Router</NavLink></li>
10+
<li><NavLink to="/repos/rackt/react-router">React Router</NavLink></li>
1111
<li><NavLink to="/repos/facebook/react">React</NavLink></li>
1212
</ul>
1313
{this.props.children}

lessons/12-navigating/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export default React.createClass({
2727
<div>
2828
<h2>Repos</h2>
2929
<ul>
30-
<li><NavLink to="/repos/reactjs/react-router">React Router</NavLink></li>
30+
<li><NavLink to="/repos/rackt/react-router">React Router</NavLink></li>
3131
<li><NavLink to="/repos/facebook/react">React</NavLink></li>
3232
{/* add this form */}
3333
<li>

lessons/12-navigating/modules/Repos.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export default React.createClass({
77
<div>
88
<h2>Repos</h2>
99
<ul>
10-
<li><NavLink to="/repos/reactjs/react-router">React Router</NavLink></li>
10+
<li><NavLink to="/repos/rackt/react-router">React Router</NavLink></li>
1111
<li><NavLink to="/repos/facebook/react">React</NavLink></li>
1212
</ul>
1313
{this.props.children}

lessons/13-server-rendering/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ into it.
8787
```js
8888
// modules/routes.js
8989
import React from 'react'
90-
import { Route, IndexRoute } from 'react-router'
90+
import { Router, Route, browserHistory, IndexRoute } from 'react-router'
9191
import App from './App'
9292
import About from './About'
9393
import Repos from './Repos'

lessons/13-server-rendering/modules/Repos.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export default React.createClass({
1919
<div>
2020
<h2>Repos</h2>
2121
<ul>
22-
<li><NavLink to="/repos/reactjs/react-router">React Router</NavLink></li>
22+
<li><NavLink to="/repos/rackt/react-router">React Router</NavLink></li>
2323
<li><NavLink to="/repos/facebook/react">React</NavLink></li>
2424
<li>
2525
<form onSubmit={this.handleSubmit}>

lessons/14-whats-next/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ Thanks for sticking with this tutorial all the way to the end!
44

55
If you want to learn more:
66

7-
1. Browse and run the [examples](https://github.com/reactjs/react-router/tree/latest/examples)
8-
- Read the [docs](https://github.com/reactjs/react-router/tree/latest/docs)
7+
1. Browse and run the [examples](https://github.com/rackt/react-router/tree/latest/examples)
8+
- Read the [docs](https://github.com/rackt/react-router/tree/latest/docs)
99
- Read the source.
1010

1111
Happy routing!

lessons/14-whats-next/modules/Repos.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export default React.createClass({
1919
<div>
2020
<h2>Repos</h2>
2121
<ul>
22-
<li><NavLink to="/repos/reactjs/react-router">React Router</NavLink></li>
22+
<li><NavLink to="/repos/rackt/react-router">React Router</NavLink></li>
2323
<li><NavLink to="/repos/facebook/react">React</NavLink></li>
2424
<li>
2525
<form onSubmit={this.handleSubmit}>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<!doctype html public="storage">
2+
<html>
3+
<meta charset=utf-8/>
4+
<title>My First React Router App</title>
5+
<link rel=stylesheet href=/index.css>
6+
<div id=app></div>
7+
<script src="/bundle.js"></script>

0 commit comments

Comments
 (0)