1.0.1 • Published 4 years ago
@matthamlin/error-boundary v1.0.1
@matthamlin/error-boundary
A generic ErrorBoundry component.
API
import ErrorBoundary from '@matthamlin/error-boundary'
function Fallback({ error }) {
// render fallback UI
}
render(
<ErrorBoundary Fallback={Fallback} onError={err => logErr(err)}>
<App />
</ErrorBoundary>,
)
The default export of the library exposes an ErrorBoundary
component that
supports the following props:
children
- The React tree that may throw an errorFallback
- A React component to render when an error is caughtonError
- A callback prop called when an error is caught