Skip to content

Commit

Permalink
fix: ensure the fallback props are the correct type
Browse files Browse the repository at this point in the history
  • Loading branch information
kentcdodds committed Apr 30, 2020
1 parent 3c34d8c commit bdcb1f9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ class ErrorBoundary extends React.Component {
error,
resetErrorBoundary: this.resetErrorBoundary,
}
if (fallback) {
if (React.isValidElement(fallback)) {
return fallback
} else if (fallbackRender) {
} else if (typeof fallbackRender === 'function') {
return fallbackRender(props)
} else if (FallbackComponent) {
} else if (typeof FallbackComponent === 'function') {
return <FallbackComponent {...props} />
} else {
throw new Error(
Expand Down

0 comments on commit bdcb1f9

Please sign in to comment.