# @feizheng/react-error-boundary

> ErrorBoundary component for react.

Latest version **1.0.0** (published 2019-12-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install @feizheng/react-error-boundary
pnpm add @feizheng/react-error-boundary
yarn add @feizheng/react-error-boundary
bun add @feizheng/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 | 2019-12-13 |
| First published | 2019-12-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Unpacked size | 8.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | afei |
| Maintainers | afeiship |
| Keywords | react, component |

## Links

- npm: https://www.npmjs.com/package/@feizheng/react-error-boundary
- Repository: https://github.com/afeiship/react-error-boundary
- Homepage: https://github.com/afeiship/react-error-boundary#readme
- Issues: https://github.com/afeiship/react-error-boundary/issues
- npm.io page: https://npm.io/package/@feizheng/react-error-boundary

## Dependencies (5)

- [react](https://npm.io/package/react.md) ^16.8.5
- [react-dom](https://npm.io/package/react-dom.md) ^16.8.5
- [classnames](https://npm.io/package/classnames.md) ^2.2.6
- [prop-types](https://npm.io/package/prop-types.md) ^15.7.2
- [@feizheng/noop](https://npm.io/package/@feizheng/noop.md) ^1.0.0

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2019-12-13

## README

# react-error-boundary
> ErrorBoundary component for react.

## installation
```shell
npm install -S @feizheng/react-error-boundary
```
## properties
| property  | type     | default | description              |
| --------- | -------- | ------- | ------------------------ |
| className | String   | -       | The extended classname   |
| error     | Function | -       | Error component replacer |
| onChange  | Function | -       | When error caught        |

## usage
1. import css
  ```scss
  @import "~@feizheng/react-error-boundary/dist/style.scss";

  // customize your styles:
  $react-error-boundary-options: ()
  ```
2. import js
  ```js
  import ReactErrorBoundary from '../src/main';
  import ReactDOM from 'react-dom';
  import React from 'react';
  import BuggyComponent from './buggy-component';
  import BuggyButton from './buggy-button';
  import './assets/style.scss';


  class App extends React.Component {
    onChange = inEvent => {
      console.log('error', inEvent);
    };

    render() {
      return (
        <div className="app-container">
          <ReactErrorBoundary onChange={this.onChange}>
            <BuggyComponent />
            <BuggyButton />
          </ReactErrorBoundary>
        </div>
      );
    }
  }

  ReactDOM.render(<App />, document.getElementById('app'));
  ```

## documentation
- https://afeiship.github.io/react-error-boundary/

## resources
- http://react.html.cn/docs/error-boundaries.html
- https://codepen.io/gaearon/pen/wqvxGa?editors=0010
- https://juejin.im/post/5c00fc505188251d09201054

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