File tree 3 files changed +36
-2
lines changed
3 files changed +36
-2
lines changed Original file line number Diff line number Diff line change 1
1
var React = require ( 'react' ) ;
2
+ var withoutProperties = require ( '../utils/withoutProperties' ) ;
3
+
4
+ /**
5
+ * A map of <Route> component props that are reserved for use by the
6
+ * router and/or React. All other props are considered "static" and
7
+ * are passed through to the route handler.
8
+ */
9
+ var RESERVED_PROPS = {
10
+ handler : true ,
11
+ path : true ,
12
+ defaultRoute : true ,
13
+ notFoundRoute : true ,
14
+ paramNames : true ,
15
+ children : true // ReactChildren
16
+ } ;
2
17
3
18
/**
4
19
* <Route> components specify components that are rendered to the page when the
@@ -49,9 +64,16 @@ var Route = React.createClass({
49
64
50
65
displayName : 'Route' ,
51
66
67
+ statics : {
68
+
69
+ getUnreservedProps : function ( props ) {
70
+ return withoutProperties ( props , RESERVED_PROPS ) ;
71
+ }
72
+
73
+ } ,
74
+
52
75
propTypes : {
53
76
handler : React . PropTypes . any . isRequired ,
54
- getAsyncProps : React . PropTypes . func ,
55
77
path : React . PropTypes . string ,
56
78
name : React . PropTypes . string ,
57
79
ignoreScrollBehavior : React . PropTypes . bool
Original file line number Diff line number Diff line change @@ -400,7 +400,7 @@ var Routes = React.createClass({
400
400
reversedArray ( matches ) . forEach ( function ( match ) {
401
401
var route = match . route ;
402
402
403
- props = { } ;
403
+ props = Route . getUnreservedProps ( route . props ) ;
404
404
405
405
props . ref = '__activeRoute__' ;
406
406
props . params = match . params ;
Original file line number Diff line number Diff line change
1
+ function withoutProperties ( object , properties ) {
2
+ var result = { } ;
3
+
4
+ for ( var property in object ) {
5
+ if ( object . hasOwnProperty ( property ) && ! properties [ property ] )
6
+ result [ property ] = object [ property ] ;
7
+ }
8
+
9
+ return result ;
10
+ }
11
+
12
+ module . exports = withoutProperties ;
You can’t perform that action at this time.
0 commit comments