[FIX] component: proper error message in dev mode in some cases

This commit is contained in:
Géry Debongnie
2022-01-24 13:14:50 +01:00
committed by Aaron Bohy
parent 72962f1dd1
commit 6639d361c3
3 changed files with 41 additions and 0 deletions
+5
View File
@@ -39,6 +39,11 @@ export const validateProps = function (name: string | typeof Component, props: a
typeof name !== "string" ? name : parent.constructor.components[name]
) as typeof Component;
if (!ComponentClass) {
// this is an error, wrong component. We silently return here instead so the
// error is triggered by the usual path ('component' function)
return;
}
applyDefaultProps(props, ComponentClass);
let propsDef = getPropDescription(ComponentClass.props);