react-error-boundary is a reusable React error boundary component that wraps parts of your component tree to catch rendering errors and display fallback UI.
React error boundaries are a built-in mechanism for handling errors during rendering, but they require class components to implement. This library solves that by providing a simple component wrapper that works with functional components and supports all React renderers including React DOM and React Native. You wrap an ErrorBoundary around the section of your tree where you want error handling, and it catches errors thrown during rendering below it. When an error occurs, you can display a fallback UI and provide a reset function to retry rendering.
The tool is straightforward to adopt for any React project needing error handling during render. It works across different React environments and rendering targets. The library explicitly documents what it does and does not catch: it catches rendering errors but not errors from event handlers, server-side rendering, async callbacks like setTimeout, or errors within the boundary itself. The documentation includes examples, API reference, and a frequently asked questions guide.
The project maintains active engagement with users through sponsorship options and maintains clear, detailed documentation. Development appears focused on keeping the library lightweight and compatible across React versions and rendering targets, with specific attention to supporting both modern ES Module environments and older frameworks through version management.