1
1
var React = require ( 'react' ) ;
2
2
var warning = require ( 'react/lib/warning' ) ;
3
- var invariant = require ( 'react/lib/invariant' ) ;
4
3
var ExecutionEnvironment = require ( 'react/lib/ExecutionEnvironment' ) ;
5
4
var mergeProperties = require ( '../helpers/mergeProperties' ) ;
6
5
var goBack = require ( '../helpers/goBack' ) ;
@@ -34,7 +33,7 @@ var REF_NAME = '__activeRoute__';
34
33
/**
35
34
* <Route> components specify components that are rendered to the page when the
36
35
* URL matches a given pattern.
37
- *
36
+ *
38
37
* Routes are arranged in a nested tree structure. When a new URL is requested,
39
38
* the tree is searched depth-first to find a route whose path matches the URL.
40
39
* When one is found, all routes in the tree that lead to it are considered
@@ -117,7 +116,7 @@ var Route = React.createClass({
117
116
location : React . PropTypes . oneOf ( [ 'hash' , 'history' ] ) . isRequired ,
118
117
handler : React . PropTypes . any . isRequired ,
119
118
path : React . PropTypes . string ,
120
- name : React . PropTypes . string ,
119
+ name : React . PropTypes . string
121
120
} ,
122
121
123
122
getDefaultProps : function ( ) {
@@ -265,6 +264,7 @@ function Redirect(to, params, query) {
265
264
266
265
function findMatches ( path , route ) {
267
266
var children = route . props . children , matches ;
267
+ var params ;
268
268
269
269
// Check the subtree first to find the most deeply-nested match.
270
270
if ( Array . isArray ( children ) ) {
@@ -277,7 +277,7 @@ function findMatches(path, route) {
277
277
278
278
if ( matches ) {
279
279
var rootParams = getRootMatch ( matches ) . params ;
280
- var params = { } ;
280
+ params = { } ;
281
281
282
282
Path . extractParamNames ( route . props . path ) . forEach ( function ( paramName ) {
283
283
params [ paramName ] = rootParams [ paramName ] ;
@@ -289,7 +289,7 @@ function findMatches(path, route) {
289
289
}
290
290
291
291
// No routes in the subtree matched, so check this route.
292
- var params = Path . extractParams ( route . props . path , path ) ;
292
+ params = Path . extractParams ( route . props . path , path ) ;
293
293
294
294
if ( params )
295
295
return [ makeMatch ( route , params ) ] ;
@@ -422,7 +422,7 @@ function checkTransitionFromHooks(matches, transition) {
422
422
function checkTransitionToHooks ( matches , transition ) {
423
423
var promise = Promise . resolve ( ) ;
424
424
425
- matches . forEach ( function ( match , index ) {
425
+ matches . forEach ( function ( match ) {
426
426
promise = promise . then ( function ( ) {
427
427
var handler = match . route . props . handler ;
428
428
0 commit comments