From 7c73a7a631a7184f124b0d2bb61036cfc3b3cbbe Mon Sep 17 00:00:00 2001 From: Andrey Ivlev <413429+skyh@users.noreply.github.com> Date: Mon, 7 Oct 2019 21:17:22 +0300 Subject: [PATCH] Fix isClassComponent function (#1571) `Object.getPrototypeOf(component)` returns React `function Component()` function itself, not `Component.prototype`. --- src/utils.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/utils.js b/src/utils.js index 63a20dd..cd5a8dd 100755 --- a/src/utils.js +++ b/src/utils.js @@ -288,7 +288,10 @@ export function flexRender(Comp, props) { function isClassComponent(component) { return ( typeof component === 'function' && - !!Object.getPrototypeOf(component).isReactComponent + !!(() => { + let proto = Object.getPrototypeOf(component) + return proto.prototype && proto.prototype.isReactComponent + })() ) }