Skip to content
This repository was archived by the owner on Jun 6, 2022. It is now read-only.

Commit 247cfd7

Browse files
committed
Update README
1 parent d300d73 commit 247cfd7

File tree

1 file changed

+7
-17
lines changed

1 file changed

+7
-17
lines changed

README.md

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,18 @@ descriptors — `Location` and `NotFound`.
2020
var Locations = Router.Locations
2121
var Location = Router.Location
2222

23+
var MainPage = React.createClass(...)
24+
var UserPage = React.createClass(...)
25+
var NotFoundPage = React.createClass(...)
26+
2327
var App = React.createClass({
2428

2529
render: function() {
2630
return (
2731
<Locations>
28-
<Location path="/">
29-
{function() { return <div>Main page</div> }}
30-
</Location>
31-
<Location path="/users/:username">
32-
{function(props) { return <div>{props.username}'s page</div> }}
33-
</Location>
34-
<NotFound>
35-
{function() { return <div>404!</div> }}
36-
</NotFound>
32+
<Location path="/" handler={MainPage} />
33+
<Location path="/users/:username" handler={UserPage} />
34+
<NotFound handler={NotFoundPage} />
3735
</Locations>
3836
)
3937
}
@@ -42,14 +40,6 @@ descriptors — `Location` and `NotFound`.
4240
That way `App` will render a markup for a currently active location (via
4341
`window.location.pathname`).
4442

45-
If you don't want to specify handlers for each location inline you can pass them
46-
a `handler` prop with a component class instead:
47-
48-
<Locations>
49-
<Location path="/" handler={MainPage} />
50-
<Location path="/users/:username" handler={UserPage} />
51-
</Locations>
52-
5343
It automatically handles `popstate` event and updates its state accordingly.
5444

5545
To navigate to a different location, component exposes `navigate(path)` method.

0 commit comments

Comments
 (0)