File tree 1 file changed +13
-6
lines changed
1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -37,13 +37,20 @@ function createRouter(component) {
37
37
var match , page , notFound ;
38
38
var len , i ;
39
39
40
- for ( i = 0 , len = this . props . children . length ; i < len ; i ++ ) {
41
- var current = this . props . children [ i ] ;
40
+ var children = this . props . children ;
41
+
42
+ if ( ! Array . isArray ( children ) ) {
43
+ children = [ children ] ;
44
+ }
45
+
46
+ for ( i = 0 , len = children . length ; i < len ; i ++ ) {
47
+ var current = children [ i ] ;
42
48
43
49
if ( process . env . NODE_ENV !== "production" ) {
44
50
invariant (
45
51
current . handler !== undefined && current . path !== undefined ,
46
- "Router should contain either Route or NotFound components as children" )
52
+ "Router should contain either Route or NotFound components " +
53
+ "as children" )
47
54
}
48
55
49
56
if ( current . path ) {
@@ -60,11 +67,11 @@ function createRouter(component) {
60
67
}
61
68
}
62
69
63
- var handler = page ? page . handler :
64
- notFound ? notFound . handler :
70
+ var rendered = page ? page . handler ( match ) :
71
+ notFound ? notFound . handler ( match ) :
65
72
[ ] ;
66
73
67
- return this . transferPropsTo ( component ( null , handler ( match ) ) ) ;
74
+ return this . transferPropsTo ( component ( null , rendered ) ) ;
68
75
}
69
76
} ) ;
70
77
}
You can’t perform that action at this time.
0 commit comments