# react-err-boundary

> ## A straight-forward light weight error boundary for React components

Latest version **1.2.4** (published 2021-06-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-err-boundary
pnpm add react-err-boundary
yarn add react-err-boundary
bun add react-err-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.2.4 |
| Published | 2021-06-29 |
| First published | 2021-03-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 8 |
| Unpacked size | 14 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | AJ LaBarre |
| Maintainers | ajlabarre |
| Keywords | react, reactjs, error |

## Links

- npm: https://www.npmjs.com/package/react-err-boundary
- Repository: https://github.com/ajlabarre/react-err-boundary
- Issues: https://github.com/ajlabarre/react-err-boundary/issues
- npm.io page: https://npm.io/package/react-err-boundary

## Dependencies (8)

- [react](https://npm.io/package/react.md) ^17.0.2
- [rimraf](https://npm.io/package/rimraf.md) ^3.0.2
- [@babel/cli](https://npm.io/package/@babel/cli.md) ^7.14.5
- [prop-types](https://npm.io/package/prop-types.md) ^15.7.2
- [@babel/core](https://npm.io/package/@babel/core.md) ^7.14.6
- [@babel/preset-env](https://npm.io/package/@babel/preset-env.md) ^7.14.7
- [@babel/preset-react](https://npm.io/package/@babel/preset-react.md) ^7.14.5
- [@babel/plugin-proposal-decorators](https://npm.io/package/@babel/plugin-proposal-decorators.md) ^7.14.5

## Alternatives

- [@sentry/react-native](https://npm.io/package/@sentry/react-native.md) — 2.6M weekly downloads
- [@ardatan/aggregate-error](https://npm.io/package/@ardatan/aggregate-error.md) — 708.1K weekly downloads
- [custom-error-generator](https://npm.io/package/custom-error-generator.md) — 2.0K weekly downloads
- [@technik-sde/prosemirror-recreate-transform](https://npm.io/package/@technik-sde/prosemirror-recreate-transform.md) — 1.5K weekly downloads
- [@suchipi/error-utils](https://npm.io/package/@suchipi/error-utils.md) — 78 weekly downloads

## Recent versions

- 1.2.4 (latest) — 2021-06-29
- 1.2.3 — 2021-03-27
- 1.1.1 — 2021-03-20
- 1.1.0 — 2021-03-20
- 1.0.0 — 2021-03-20
- 0.0.5 — 2021-03-20
- 0.0.4 — 2021-03-20
- 0.0.2 — 2021-03-19
- 0.0.1 — 2021-03-19
- 0.0.0 — 2021-03-19

## README

# react-err-boundry

## A straight-forward light weight error boundary for React components

This easy to implement error boundary component isolates errors to the child component that throws them so your entire react app doesn't crash on error.

## Features

- A simple component which catches errors thrown in child component tree, logs the error and displays a fallback UI
- The Error Boundary catches errors during rendering, in lifecycle methods, and in constructors of the whole tree below them.

## Installation

Installation is as simple as running the following command in your project's root directory

```
npm i --save react-err-boundary
```

## Usage

Usage is very straight-forward! Simply wrap your component in the Error Boundary component to create an error boundary

```javascript
import ErrorBoundary from 'react-err-boundary';

...

<ErrorBoundary>
  <MyComponent />
</ErrorBoundary>
```

## Props

```javascript
ErrorBoundary.propTypes = {
  // Children nodes to be rendered
  children: PropTypes.node,
  // UI to be displayed in case of error
  displayError: PropTypes.node,
  // Error handling function
  onError: PropTypes.func,
  // Optional logger
  logger: PropTypes.object,
};

ErrorBoundary.defaultProps = {
  onError: () => {},
};
```

## License

MIT
**Free Software, Hell Yeah!**

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