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.
This commit is contained in:
Jeremy Liberman
2018-10-04 14:42:16 -06:00
committed by Tanner Linsley
parent 02e65b4388
commit 7876a3876c
+1 -5
View File
@@ -205,11 +205,7 @@ function isSortingDesc (d) {
function normalizeComponent (Comp, params = {}, fallback = Comp) {
return typeof Comp === 'function' ? (
Object.getPrototypeOf(Comp).isReactComponent ? (
<Comp {...params} />
) : (
Comp(params)
)
<Comp {...params} />
) : (
fallback
)