-
Notifications
You must be signed in to change notification settings - Fork 49.8k
Closed
Milestone
Description
We should deprecate isValidClass. In 0.13, any function that returns an object with a render method will be a valid class.
We probably don't want to assume that there is a valid prototype because that doesn't allow the module pattern to be used:
function MyComponent(props) {
return {
render: function() {
return <div />;
}
};
}It's really difficult to validate these without invoking them. This is where a static type system shines. For a dynamic check, isValidClass would turn into: typeof fn === 'function' which doesn't need its own function.
Generally, you'll want to validate something extra about the class anyway. E.g. will it have a getDOMNode method on it? Does it render into a table cell?
Metadata
Metadata
Assignees
Labels
No labels