# @matthamlin/react-error-boundary

> A simple error boundary component for React 16+

Latest version **1.0.0** (published 2018-02-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install @matthamlin/react-error-boundary
pnpm add @matthamlin/react-error-boundary
yarn add @matthamlin/react-error-boundary
bun add @matthamlin/react-error-boundary
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2018-02-09 |
| First published | 2018-02-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 140.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Matthew Hamlin |
| Maintainers | matthamlin |

## Links

- npm: https://www.npmjs.com/package/@matthamlin/react-error-boundary
- npm.io page: https://npm.io/package/@matthamlin/react-error-boundary

## Recent versions

- 1.0.0 (latest) — 2018-02-09

## README

# React-Error-Boundary 🚯

An unopinionated `<ErrorBoundary />` React component for React 16+.

```JSX
<div>
  <ErrorBoundary
    onCaughtError={logError}
  >
    {error => error
      ? (
        <h1>Oh no an error occurred!</h1>
      )
      : (
        <Application />
      )
    }
  </ErrorBoundary>
</div>
```

## Props:

* `onCaughtError` method called after `<ErrorBoundary />` catches an error.
  * type `function` 
  * Called with one argument, the `error` object thrown
* `children` function 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

---
_Source: https://npm.io/package/@matthamlin/react-error-boundary · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
