From 7876a3876c3129251f00399315b434fd841c7bc1 Mon Sep 17 00:00:00 2001 From: Jeremy Liberman Date: Thu, 4 Oct 2018 15:42:16 -0500 Subject: [PATCH] Resolve "cannot call class as a function" error (#1050) When rendering a class component using the `class extends React.Component {}` syntax, you would get an error `TypeError: Cannot call a class as a function` because the check to determine whether a component was a class component was insufficient. It seems pointless to even have a check, however, because the JSX syntax can render both class and functional components. --- src/utils.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/utils.js b/src/utils.js index eba20d4..0b1d7ab 100644 --- a/src/utils.js +++ b/src/utils.js @@ -205,11 +205,7 @@ function isSortingDesc (d) { function normalizeComponent (Comp, params = {}, fallback = Comp) { return typeof Comp === 'function' ? ( - Object.getPrototypeOf(Comp).isReactComponent ? ( - - ) : ( - Comp(params) - ) + ) : ( fallback )