11import invariant from 'invariant'
22import React , { Component } from 'react'
3+ import { isReactChildren } from './RouteUtils'
34import getRouteParams from './getRouteParams'
45
56const { array, func, object } = React . PropTypes
@@ -46,7 +47,7 @@ class RoutingContext extends Component {
4647 if ( components ) {
4748 element = components . reduceRight ( ( element , components , index ) => {
4849 if ( components == null )
49- return element // Don't create new children use the grandchildren.
50+ return element // Don't create new children; use the grandchildren.
5051
5152 const route = routes [ index ]
5253 const routeParams = getRouteParams ( route , params )
@@ -59,13 +60,18 @@ class RoutingContext extends Component {
5960 routes
6061 }
6162
62- if ( element )
63+ if ( isReactChildren ( element ) ) {
6364 props . children = element
65+ } else if ( element ) {
66+ for ( let prop in element )
67+ if ( element . hasOwnProperty ( prop ) )
68+ props [ prop ] = element [ prop ]
69+ }
6470
6571 if ( typeof components === 'object' ) {
6672 const elements = { }
6773
68- for ( const key in components )
74+ for ( let key in components )
6975 if ( components . hasOwnProperty ( key ) )
7076 elements [ key ] = this . createElement ( components [ key ] , props )
7177
0 commit comments