1
1
import React from 'react'
2
- import warning from './routerWarning'
3
2
4
3
function isValidChild ( object ) {
5
4
return object == null || React . isValidElement ( object )
@@ -9,20 +8,6 @@ export function isReactChildren(object) {
9
8
return isValidChild ( object ) || ( Array . isArray ( object ) && object . every ( isValidChild ) )
10
9
}
11
10
12
- function checkPropTypes ( componentName , propTypes , props ) {
13
- componentName = componentName || 'UnknownComponent'
14
-
15
- for ( const propName in propTypes ) {
16
- if ( Object . prototype . hasOwnProperty . call ( propTypes , propName ) ) {
17
- const error = propTypes [ propName ] ( props , propName , componentName )
18
-
19
- /* istanbul ignore if: error logging */
20
- if ( error instanceof Error )
21
- warning ( false , error . message )
22
- }
23
- }
24
- }
25
-
26
11
function createRoute ( defaultProps , props ) {
27
12
return { ...defaultProps , ...props }
28
13
}
@@ -31,9 +16,6 @@ export function createRouteFromReactElement(element) {
31
16
const type = element . type
32
17
const route = createRoute ( type . defaultProps , element . props )
33
18
34
- if ( type . propTypes )
35
- checkPropTypes ( type . displayName || type . name , type . propTypes , route )
36
-
37
19
if ( route . children ) {
38
20
const childRoutes = createRoutesFromReactChildren ( route . children , route )
39
21
@@ -52,7 +34,7 @@ export function createRouteFromReactElement(element) {
52
34
* nested.
53
35
*
54
36
* import { Route, createRoutesFromReactChildren } from 'react-router'
55
- *
37
+ *
56
38
* const routes = createRoutesFromReactChildren(
57
39
* <Route component={App}>
58
40
* <Route path="home" component={Dashboard}/>
0 commit comments