@@ -42,7 +42,7 @@ function createRouter(component) {
4242
4343 if ( process . env . NODE_ENV !== "production" ) {
4444 invariant (
45- current . children !== undefined && current . path !== undefined ,
45+ current . handler !== undefined && current . path !== undefined ,
4646 "Router should contain either Route or NotFound components as children" )
4747 }
4848
@@ -60,27 +60,27 @@ function createRouter(component) {
6060 }
6161 }
6262
63- var children = page ? page . children :
64- notFound ? notFound . children :
63+ var handler = page ? page . handler :
64+ notFound ? notFound . handler :
6565 [ ] ;
6666
67- return this . transferPropsTo ( component ( null , children ( match ) ) ) ;
67+ return this . transferPropsTo ( component ( null , handler ( match ) ) ) ;
6868 }
6969 } ) ;
7070}
7171
72- function Route ( props , children ) {
72+ function Route ( props , handler ) {
7373 invariant (
74- typeof children === 'function' ,
75- "Route children should be a template" ) ;
76- return { path : props . path , children : children } ;
74+ typeof props . handler === 'function' || typeof handler === 'function' ,
75+ "Route handler should be a template" ) ;
76+ return { path : props . path , handler : props . handler || handler } ;
7777}
7878
79- function NotFound ( _props , children ) {
79+ function NotFound ( props , handler ) {
8080 invariant (
81- typeof children === 'function' ,
82- "NotFound children should be a template" ) ;
83- return { path : null , children : children } ;
81+ typeof props . handler === 'function' || typeof handler === 'function' ,
82+ "NotFound handler should be a template" ) ;
83+ return { path : null , handler : props . handler || handler } ;
8484}
8585
8686module . exports = {
0 commit comments