mirror of
https://github.com/gosticks/react-table.git
synced 2026-12-06 12:41:49 +00:00
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:
committed by
Tanner Linsley
parent
02e65b4388
commit
7876a3876c
+1
-5
@@ -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
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user