Skip to content
Permalink
Browse files

Fix isClassComponent function (#1571)

`Object.getPrototypeOf(component)` returns React `function Component()` function itself, not `Component.prototype`.
  • Loading branch information...
skyh authored and tannerlinsley committed Oct 7, 2019
1 parent cbb1836 commit 7c73a7a631a7184f124b0d2bb61036cfc3b3cbbe
Showing with 4 additions and 1 deletion.
  1. +4 −1 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
})()
)
}

0 comments on commit 7c73a7a

Please sign in to comment.
You can’t perform that action at this time.