File tree Expand file tree Collapse file tree 3 files changed +36
-2
lines changed Expand file tree Collapse file tree 3 files changed +36
-2
lines changed Original file line number Diff line number Diff line change 11var 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+ } ;
217
318/**
419 * <Route> components specify components that are rendered to the page when the
@@ -49,9 +64,16 @@ var Route = React.createClass({
4964
5065 displayName : 'Route' ,
5166
67+ statics : {
68+
69+ getUnreservedProps : function ( props ) {
70+ return withoutProperties ( props , RESERVED_PROPS ) ;
71+ }
72+
73+ } ,
74+
5275 propTypes : {
5376 handler : React . PropTypes . any . isRequired ,
54- getAsyncProps : React . PropTypes . func ,
5577 path : React . PropTypes . string ,
5678 name : React . PropTypes . string
5779 } ,
Original file line number Diff line number Diff line change @@ -387,7 +387,7 @@ var Routes = React.createClass({
387387 reversedArray ( matches ) . forEach ( function ( match ) {
388388 var route = match . route ;
389389
390- props = { } ;
390+ props = Route . getUnreservedProps ( route . props ) ;
391391
392392 props . ref = '__activeRoute__' ;
393393 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