Skip to content

Commit 544fe91

Browse files
committed
bring headers back one
1 parent 336ad16 commit 544fe91

14 files changed

+96
-95
lines changed

docs/ConfirmingNavigation.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## Confirming Navigation
1+
# Confirming Navigation
22

33
React Router provides a [`routerWillLeave` lifecycle hook](Glossary.md#routehook) that React [component](Glossary.md#component)s may use to prevent a transition from happening or to prompt the user before leaving a [route](Glossary.md#route). `routerWillLeave` may either 1) `return false` to cancel the transition or 2) `return` a prompt message that will prompt the user for confirmation before leaving the route.
44

@@ -12,7 +12,7 @@ var Home = React.createClass({
1212
// Assuming Home is a route component, it may use the
1313
// Lifecycle mixin to get a routerWillLeave method.
1414
mixins: [ Lifecycle ],
15-
15+
1616
routerWillLeave(nextLocation) {
1717
if (!this.state.isSaved)
1818
return 'Your work is not saved! Are you sure you want to leave?';

docs/DynamicRouting.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## Dynamic Routing
1+
# Dynamic Routing
22

33
React Router is great for small sites like [React.js Training](https://reactjs-training.com) ("React Router brought to you by ...") but it's built with websites like [Facebook](https://www.facebook.com/) and [Twitter](https://twitter.com/) in mind, too.
44

docs/Glossary.md

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
## Glossary
1+
# Glossary
22

33
This is a glossary of common terms used in the React Router codebase and documentation listed in alphabetical order, along with their [type signatures](http://flowtype.org/docs/quick-reference.html).
44

5-
### Action
5+
## Action
66

77
type Action = 'PUSH' | 'REPLACE' | 'POP';
88

@@ -12,13 +12,13 @@ An *action* describes the type of change to a URL. Possible values are:
1212
- `REPLACE` – indicates the current item in history was altered
1313
- `POP` – indicates there is a new current item, i.e. the "current pointer" changed
1414

15-
### Component
15+
## Component
1616

1717
type Component = ReactClass | string;
1818

1919
A *component* is a React component class or a string (e.g. "div"). Basically, it's anything that can be used as the first argument to [`React.createElement`](https://facebook.github.io/react/docs/top-level-api.html#react.createelement).
2020

21-
### EnterHook
21+
## EnterHook
2222

2323
type EnterHook = (nextState: RouterState, redirectTo: RedirectFunction, callback?: Function) => any;
2424

@@ -28,13 +28,13 @@ If an enter hook needs to execute asynchronously, it may list a 3rd `callback` a
2828

2929
**Caution:** Using the `callback` in an enter hook causes the transition to wait until it is called. **This can lead to a non-responsive UI if you don't call it very quickly**.
3030

31-
### LeaveHook
31+
## LeaveHook
3232

3333
type LeaveHook = () => any;
3434

3535
A *leave hook* is a user-defined function that is called when a route is about to be unmounted.
3636

37-
### Location
37+
## Location
3838

3939
type Location = {
4040
pathname: Pathname;
@@ -52,13 +52,13 @@ A *location* answers two important (philosophical) questions:
5252

5353
New locations are typically created each time the URL changes. You can read more about locations in [the `history` docs](https://github.com/rackt/history/blob/master/docs/Location.md).
5454

55-
### LocationKey
55+
## LocationKey
5656

5757
type LocationKey = string;
5858

5959
A *location key* is a string that is unique to a particular [`location`](#location). It is the one piece of data that most accurately answers the question "Where am I?".
6060

61-
### LocationState
61+
## LocationState
6262

6363
type LocationState = ?Object;
6464

@@ -69,43 +69,43 @@ This type gets its name from the first argument to HTML5's [`pushState`][pushSta
6969
[pushState]: https://developer.mozilla.org/en-US/docs/Web/API/History_API#The_pushState()_method
7070
[replaceState]: https://developer.mozilla.org/en-US/docs/Web/API/History_API#The_replaceState()_method
7171

72-
### Path
72+
## Path
7373

7474
type Path = Pathname + QueryString;
7575

7676
A *path* represents a URL path.
7777

78-
### Pathname
78+
## Pathname
7979

8080
type Pathname = string;
8181

8282
A *pathname* is the portion of a URL that describes a hierarchical path, including the preceeding `/`. For example, in `http://example.com/the/path?the=query`, `/the/path` is the pathname. It is synonymous with `window.location.pathname` in web browsers.
8383

84-
### QueryString
84+
## QueryString
8585

8686
type QueryString = string;
8787

8888
A *query string* is the portion of the URL that follows the [pathname](#pathname), including any preceeding `?`. For example, in `http://example.com/the/path?the=query`, `?the=query` is the query string. It is synonymous with `window.location.search` in web browsers.
8989

90-
### Query
90+
## Query
9191

9292
type Query = Object;
9393

9494
A *query* is the parsed version of a [query string](#querystring).
9595

96-
### Params
96+
## Params
9797

9898
type Params = Object;
9999

100100
The word *params* refers to an object of key/value pairs that were parsed out of the original URL's [pathname](#pathname). The values of this object are typically strings, unless there is more than one param with the same name in which case the value is an array.
101101

102-
### RedirectFunction
102+
## RedirectFunction
103103

104104
type RedirectFunction = (pathname: Pathname | Path, query: ?Query, state: ?LocationState) => void;
105105

106106
A *redirect function* is used in [`onEnter` hooks](#enterhook) to trigger a transition to a new URL.
107107

108-
### Route
108+
## Route
109109

110110
type Route = {
111111
component: RouteComponent;
@@ -118,7 +118,7 @@ A *route* specifies a [component](#component) that is part of the user interface
118118

119119
It may help to think of a route as an "entry point" into your UI. You don't need a route for every component in your component hierarchy, only for those places where your UI differs based on the URL.
120120

121-
### RouteComponent
121+
## RouteComponent
122122

123123
type RouteComponent = Component;
124124

@@ -130,19 +130,19 @@ The term *route component* refers to a [component](#component) that is directly
130130
- `route` – The [route](#route) that declared this component
131131
- `routeParams` – A subset of the [params](#params) that were specified in the route's [`path`](#routepattern)
132132

133-
### RouteConfig
133+
## RouteConfig
134134

135135
type RouteConfig = Array<Route>;
136136

137137
A *route config* is an array of [route](#route)s that specifies the order in which routes should be tried when the router attempts to match a URL.
138138

139-
### RouteHook
139+
## RouteHook
140140

141141
type RouteHook = (nextLocation?: Location) => any;
142142

143143
A *route hook* is a function that is used to prevent the user from leaving a route. On normal transitions, it receives the next [location](#location) as an argument and must either `return false` to cancel the transition or `return` a prompt message to show the user. When invoked during the `beforeunload` event in web browsers, it does not receive any arguments and must `return` a prompt message to cancel the transition.
144144

145-
### RoutePattern
145+
## RoutePattern
146146

147147
type RoutePattern = string;
148148

@@ -154,7 +154,7 @@ A *route pattern* (or "path") is a string that describes a portion of a URL. Pat
154154

155155
Route patterns are relative to the pattern of the parent route unless they begin with a `/`, in which case they begin matching at the beginning of the URL.
156156

157-
### Router
157+
## Router
158158

159159
type Router = {
160160
transitionTo: (location: Location) => void;
@@ -172,13 +172,13 @@ There are two primary interfaces for computing a router's next [state](#routerst
172172
- `history.listen` is to be used in stateful environments (such as web browsers) that need to update the UI over a period of time. This method immediately invokes its `listener` argument once and returns a function that must be called to stop listening for changes
173173
- `history.match` is a pure asynchronous function that does not update the history's internal state. This makes it ideal for server-side environments where many requests must be handled concurrently
174174

175-
### RouterListener
175+
## RouterListener
176176

177177
type RouterListener = (error: ?Error, nextState: RouterState) => void;
178178

179179
A *router listener* is a function that is used to listen for changes to a [router](#router)'s [state](#routerstate).
180180

181-
### RouterState
181+
## RouterState
182182

183183
type RouterState = {
184184
location: Location;

docs/Introduction.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
## Introduction
1+
# Introduction
22

33
To illustrate the problems React Router is going to solve for you, let's build a small application without it.
44

5-
### Without React Router
5+
## Without React Router
66

77
```js
88
var About = React.createClass({/*...*/});
@@ -92,7 +92,7 @@ path: /inbox
9292

9393
We'd have to make our URL parsing a lot smarter, and we would end up with a lot of code to figure out which branch of nested components to be rendered at any given URL: `App -> About`, `App -> Inbox -> Messages -> Message`, `App -> Inbox -> Messages -> Stats`, etc.
9494

95-
### With React Router
95+
## With React Router
9696

9797
Let's refactor our app to use React Router.
9898

@@ -150,7 +150,7 @@ var routes = {
150150
React.render(<Router routes={routes} />, document.body);
151151
```
152152

153-
### Adding More UI
153+
## Adding More UI
154154

155155
Alright, now we're ready to nest the inbox messages inside the inbox UI.
156156

@@ -189,7 +189,7 @@ React.render((
189189

190190
Now visits to URLs like `inbox/messages/Jkei3c32` will match the new route and nest the UI branch of `App -> Inbox -> Message`.
191191

192-
### Getting URL Parameters
192+
## Getting URL Parameters
193193

194194
We're going to need to know something about the message in order to fetch it from the server. Route components get some useful properties injected into them when you render, particularly the parameters from the dynamic segment of your path. In our case, `:id`.
195195

docs/Link.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,41 @@
1-
## Link
1+
# Link
22

33
The primary way to allow users to navigate around your application.
44
`Link` will render a fully accesible anchor tag with the proper href.
55

66
A `Link` also knows when the route it links to is active and automatically
77
applies its `activeClassName` and/or `activeStyle` when it is.
88

9-
### Props
9+
## Props
1010

1111
### `to`
1212

1313
The path to link to, e.g., `/users/123`.
1414

15-
#### `query`
15+
### `query`
1616

1717
An object of key:value pairs to be stringified.
1818

19-
#### `state`
19+
### `state`
2020

2121
State to persist to the `location`.
2222

23-
#### `activeClassName`
23+
### `activeClassName`
2424

2525
The className a `Link` receives when its route is active. Defaults to `active`.
2626

27-
#### `activeStyle`
27+
### `activeStyle`
2828

2929
The styles to apply to the link element when its route is active.
3030

31-
#### `onClick`
31+
### `onClick`
3232

3333
A custom handler for the click event. Works just like a handler on an `<a>`
3434
tag - calling `e.preventDefault()` or returning `false` will prevent the
3535
transition from firing, while `e.stopPropagation()` will prevent the event
3636
from bubbling.
3737

38-
#### *others*
38+
### *others*
3939

4040
You can also pass props you'd like to be on the `<a>` such as a title, id, className, etc.
4141

docs/Plain Route.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
1-
## Plain Route
1+
# Plain Route
22

33
A plain JavaScript object route definition. `Router` turns JSX
44
`<Route/>`s into these objects, but you can use them directly if you
55
prefer. All of the props are the same as `<Route/>` props, except
66
those listed here.
77

8-
### Props
8+
## Props
99

10-
#### `childRoutes`
10+
### `childRoutes`
1111

1212
An array of child routes, same as `children` in JSX route configs.
1313

14-
#### `getChildRoutes(location, callback)`
14+
### `getChildRoutes(location, callback)`
1515

1616
Same as `childRoutes` but asynchronous and receives the `location`.
1717
Useful for code-splitting and dynamic route matching (given some state
1818
or session data to return a different set of child routes).
1919

20-
##### `callback` signature
20+
#### `callback` signature
2121

2222
`cb(err, routesArray)`
2323

24-
### Examples
24+
## Examples
2525

2626
```js
2727
let myRoute = {

docs/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## Table of Contents
1+
# Table of Contents
22

33
- [Glossary](Glossary.md)
44
- Guides

docs/Redirect.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
1-
## Redirect
1+
# Redirect
22

33
A `Redirect` sets up a redirect to another route in your application to
44
maintain old URLs.
55

6-
### Props
6+
## Props
77

8-
#### `from`
8+
### `from`
99

1010
The path you want to redirect from, including dynamic segments.
1111

12-
#### `to`
12+
### `to`
1313

1414
The path you want to redirect to.
1515

16-
#### `query`
16+
### `query`
1717

1818
By default, the query parameters will just pass through but you can
1919
specify them if you need to.
2020

21-
### Example
21+
## Example
2222

2323
```js
2424
// lets say we want to change from `/profile/123` to `/about/123`

0 commit comments

Comments
 (0)