Skip to content

Commit 28c559d

Browse files
committed
Don't use complex ReactComponent typecheck, just typecheck func
1 parent 68e843f commit 28c559d

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

lib/Route.js

+3-8
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,15 @@
22

33
var React = require('react');
44

5-
//! FIXME how do you typecheck a React Component (not an Element)?
6-
function isComponent(props, propName) {
7-
if (!React.isValidElement(React.createElement(props[propName]))) {
8-
throw new Error("Expected an element type or component.");
9-
}
10-
}
11-
125
function createClass(name) {
136
return React.createClass({
147
displayName: name,
158
propTypes: {
169
handler: React.PropTypes.oneOfType([
10+
// Can be ReactElement or ReactComponent, unfortunately there is no way to typecheck
11+
// ReactComponent (that I know of)
1712
React.PropTypes.element,
18-
isComponent
13+
React.PropTypes.func
1914
]),
2015
path: name === 'NotFound' ?
2116
function(props, propName) {

0 commit comments

Comments
 (0)