Skip to content

Commit

Permalink
Warn if the included mixin is undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
Swaroop SM committed Mar 1, 2016
1 parent 56c423a commit 3a37e77
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/isomorphic/classic/class/ReactClass.js
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,20 @@ function validateMethodOverride(isAlreadyDefined, name) {
*/
function mixSpecIntoComponent(Constructor, spec) {
if (!spec) {
if(__DEV__) {
var typeofSpec = typeof spec;
var isMixinValid = typeofSpec === 'object' && spec !== null;

warning(
isMixinValid,
'%s: You\'re attempting to ' +
'include a mixin that is either null or not an object. ' +
'Expected object but got %s',
Constructor.displayName || 'ReactClass',
spec === null ? null : typeofSpec
);
}

return;
}

Expand Down

0 comments on commit 3a37e77

Please sign in to comment.