1.0.0 • Published 8 years ago
@matthamlin/react-error-boundary v1.0.0
React-Error-Boundary 🚯
An unopinionated <ErrorBoundary /> React component for React 16+.
<div>
<ErrorBoundary
onCaughtError={logError}
>
{error => error
? (
<h1>Oh no an error occurred!</h1>
)
: (
<Application />
)
}
</ErrorBoundary>
</div>Props:
onCaughtErrormethod called after<ErrorBoundary />catches an error.- type
function - Called with one argument, the
errorobject thrown
- type
childrenfunction called inside render- Called with the error object, will be null initially
- This is the only thing returned from render, so you have full control over rendering
1.0.0
8 years ago