A reusable React error boundary component for catching rendering errors and displaying fallback UIs.
react-error-boundary is a reusable React component that implements error boundaries to catch JavaScript errors during rendering in React applications. It allows developers to wrap parts of their component tree to prevent crashes and display custom fallback UIs when errors occur, enhancing application stability and user experience.
React developers building client-side applications who need a reliable way to handle runtime errors gracefully without writing custom error boundary logic from scratch.
Developers choose react-error-boundary for its simplicity, flexibility in fallback rendering, and built-in recovery mechanisms like resetKeys, which reduce boilerplate and provide a standardized approach to error handling across React projects.
Simple reusable React error boundary component
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Supports three methods—static fallback, FallbackComponent, and fallbackRender—allowing developers to choose the best UI approach, as detailed in the optional props documentation.
Features resetKeys for automatic boundary reset on key changes and onReset for manual logic, enabling seamless recovery without extra code, mentioned in the props table.
Works with all React renderers including React DOM and React Native, ensuring consistent error handling across web and mobile platforms, as stated in the GitHub description.
Provides onError callback to log error details and component stacks to external services like Sentry, facilitating debugging in production, highlighted in the key features.
Cannot catch errors during server-side rendering, in event handlers, or asynchronous code, as per React's constraints, restricting its use in full-stack apps, admitted in the README.
Requires serializable props or 'use client' directives, limiting integration with server components or mixed rendering environments without careful setup, noted in the component description.
FAQ mentions potential mismatches between react and @types/react causing JSX errors, indicating setup complexities and dependency management issues.