Skip to content

Commit e9e071c

Browse files
authored
Merge pull request #3608 from reactjs/unknown-props
Fix issues with unknown props in docs and examples
2 parents 9c955c5 + cecc760 commit e9e071c

File tree

2 files changed

+16
-15
lines changed

2 files changed

+16
-15
lines changed

docs/Glossary.md

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ This is a glossary of common terms used in the React Router codebase and documen
1111
* [LocationDescriptor](#locationdescriptor)
1212
* [LocationKey](#locationkey)
1313
* [LocationState](#locationstate)
14+
* [Params](#params)
1415
* [Path](#path)
1516
* [Pathname](#pathname)
16-
* [Params](#params)
1717
* [Query](#query)
1818
* [QueryString](#querystring)
1919
* [RedirectFunction](#redirectfunction)
@@ -127,6 +127,14 @@ This type gets its name from the first argument to HTML5's [`pushState`][pushSta
127127
[pushState]: https://developer.mozilla.org/en-US/docs/Web/API/History_API#The_pushState()_method
128128
[replaceState]: https://developer.mozilla.org/en-US/docs/Web/API/History_API#The_replaceState()_method
129129
130+
## Params
131+
132+
```js
133+
type Params = Object;
134+
```
135+
136+
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.
137+
130138
## Path
131139
132140
```js
@@ -143,14 +151,6 @@ type Pathname = string;
143151
144152
A *pathname* is the portion of a URL that describes a hierarchical path, including the preceding `/`. 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.
145153

146-
## QueryString
147-
148-
```js
149-
type QueryString = string;
150-
```
151-
152-
A *query string* is the portion of the URL that follows the [pathname](#pathname), including any preceding `?`. 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.
153-
154154
## Query
155155

156156
```js
@@ -159,13 +159,13 @@ type Query = Object;
159159

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

162-
## Params
162+
## QueryString
163163

164164
```js
165-
type Params = Object;
165+
type QueryString = string;
166166
```
167167

168-
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.
168+
A *query string* is the portion of the URL that follows the [pathname](#pathname), including any preceding `?`. 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.
169169

170170
## RedirectFunction
171171

@@ -204,6 +204,8 @@ The term *route component* refers to a [component](#component) that is directly
204204
- `route` – The [route](#route) that declared this component
205205
- `routeParams` – A subset of the [params](#params) that were specified in the route's [`path`](#routepattern)
206206
207+
Route components should generally be component classes rather than strings. This will avoid potential issues with passing the injected props above to DOM components.
208+
207209
## RouteConfig
208210
209211
```js

examples/huge-apps/app.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
/*eslint-disable no-unused-vars */
21
import React from 'react'
32
import { render } from 'react-dom'
43
import { Router, browserHistory } from 'react-router'
5-
import stubbedCourses from './stubs/COURSES'
4+
5+
import './stubs/COURSES'
66

77
const rootRoute = {
8-
component: 'div',
98
childRoutes: [ {
109
path: '/',
1110
component: require('./components/App'),

0 commit comments

Comments
 (0)