react-error-boundary: Reusable React error boundary component. Supports all React renderers (including React DOM and React Native).
If you like this project, ๐ become a sponsor or โ buy me a coffee
# npm
npm install react-error-boundary
# pnpm
pnpm add react-error-boundary
# yarn
yarn add react-error-boundaryFrequently asked questions can be found here.
A reusable React error boundary component. Wrap this component around other React components to "catch" errors and render a fallback UI.
This package is built on top of React error boundaries, so it has all of the advantages and constraints of that API. This means that it can't catch errors during:
- Server side rendering
- Event handlers
- Asynchronous code (including effects)
โน๏ธ The component provides several ways to render a fallback: fallback, fallbackRender, and FallbackComponent.
Refer to the documentation to determine which is best for your application.
โน๏ธ This is a client component. You can only pass props to it that are serializeable or use it in files that have a "use client"; directive.
None
| Name | Description |
|---|---|
| onError | Optional callback to enable e.g. logging error information to a server.
@param error Value that was thrown; typically an instance of |
| onReset | Optional callback to to be notified when an error boundary is "reset" so React can retry the failed render. |
| resetKeys | When changed, these keys will reset a triggered error boundary. This can be useful when an error condition may be tied to some specific state (that can be uniquely identified by key). See the the documentation for examples of how to use this prop. |
| fallback | Static content to render in place of an error if one is thrown. |
| FallbackComponent | React component responsible for returning a fallback UI based on a thrown value. |
| fallbackRender | Render prop function responsible for returning a fallback UI based on a thrown value. |
This error can be caused by a version mismatch between react and @types/react. To fix this, ensure that both match exactly, e.g.:
If using NPM:
{
...
"overrides": {
"@types/react": "17.0.60"
},
...
}If using Yarn:
{
...
"resolutions": {
"@types/react": "17.0.60"
},
...
}This blog post shows more examples of how this package can be used, although it was written for the version 3 API.

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.

