@matthamlin/error-boundary

1.0.1 • Public • Published

@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 error
  • Fallback - A React component to render when an error is caught
  • onError - A callback prop called when an error is caught

Readme

Keywords

none

Package Sidebar

Install

npm i @matthamlin/error-boundary

Weekly Downloads

1

Version

1.0.1

License

MIT

Unpacked Size

5.52 kB

Total Files

8

Last publish

Collaborators

  • matthamlin