Skip to content

Commit bdcb1f9

Browse files
committed
fix: ensure the fallback props are the correct type
1 parent 3c34d8c commit bdcb1f9

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ class ErrorBoundary extends React.Component {
2020
error,
2121
resetErrorBoundary: this.resetErrorBoundary,
2222
}
23-
if (fallback) {
23+
if (React.isValidElement(fallback)) {
2424
return fallback
25-
} else if (fallbackRender) {
25+
} else if (typeof fallbackRender === 'function') {
2626
return fallbackRender(props)
27-
} else if (FallbackComponent) {
27+
} else if (typeof FallbackComponent === 'function') {
2828
return <FallbackComponent {...props} />
2929
} else {
3030
throw new Error(

0 commit comments

Comments
 (0)