react-boundary
v1.0.0
Published
Error boundaries, the hooky way.
Downloads
18
Readme
react-boundary
Error boundaries, the hooky way.
Installation
npm install react-boundary
or
yarn add react-boundary
Usage
import { boundary, useError } from 'react-boundary';
const Component = boundary(() => {
const [error, info] = useError();
return error && info ? (
<span>
Oh no! Something happened: {error.message}
{info.componentStack}
</span>
) : (
<span>
Everything is fine
</span>
);
});