Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Repair Windows errors before they cause bigger problemsFix Now →React Error Boundaries catch errors that occur while React renders a descendant component. They do not generally catch exceptions from event handlers, timers, or other asynchronous callbacks, because those failures happen outside the render work the boundary handles. Catch interaction and request failures where they occur; use a boundary for render failures. React documents narrow exceptions, including rejected Promises read with use and errors thrown inside the startTransition function returned by useTransition.
What an Error Boundary catches
An Error Boundary protects a region of the rendered component tree. When a descendant throws while React is rendering it, the boundary can render fallback UI in place of the failed region. A class boundary uses static getDerivedStateFromError to update state for that fallback; componentDidCatch can report the error and component stack to an error-reporting service. React recommends choosing boundaries around UI regions that should fail together, rather than adding one around every component. See React’s Component reference.
class ErrorBoundary extends React.Component {
state = { hasError: false };
static getDerivedStateFromError(error) {
return { hasError: true };
}
componentDidCatch(error, info) {
reportError(error, info.componentStack);
}
render() {
if (this.state.hasError) return this.props.fallback;
return this.props.children;
}
}
React’s reference describes this class-based pattern. It does not currently provide a direct function-component equivalent for componentDidCatch; use a reusable boundary component or a package that implements one if your application is otherwise built from function components.
Where different failures are handled
The key distinction is where the failure occurs, not merely whether the code belongs to a component beneath a boundary.
The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →#1 Best Overall
| Failure location or mechanism | What handles it | Practical response |
|---|---|---|
| Descendant render | Error Boundary | Show fallback UI; optionally log through componentDidCatch. |
| Event handler | The handler’s own logic | Catch expected exceptions or Promise rejections and update UI state. |
| Timer or animation callback | The callback’s own logic | Catch at the callback or route the failure into explicit application state. |
Promise read with use |
Suspense while pending; Error Boundary if rejected | Reuse a cached Promise instance and use a boundary reset or retry pattern when needed. |
| Data fetched in an Effect or event handler | Not detected by Suspense | Handle loading and failure through the fetch flow and application state. |
Error inside useTransition’s startTransition callback |
Error Boundary, as a documented exception | Treat this as a specific exception, not a general rule for async callbacks. |
Why event-handler errors bypass the boundary
An event handler runs in response to an interaction, not as part of rendering the descendant tree. Declaring the handler in a component beneath a boundary does not bring its later exceptions within the boundary’s render-error handling. Catch expected failures in the handler and represent the result in application state or local feedback.
async function handleSave() {
try {
await saveRecord();
setStatus('saved');
} catch (error) {
setStatus('failed');
}
}
This is also the right place to handle a rejected request Promise initiated by the interaction. Keep the boundary for failures that occur as React renders UI.
Why timers and ordinary async callbacks bypass it
A setTimeout or requestAnimationFrame callback runs later, outside the render phase observed by the boundary. Handle the failure where that callback or its Promise runs. If the desired outcome is boundary fallback UI, deliberately translate the failure into application state that causes a render to fail within the protected region; do not assume the original callback exception will be forwarded automatically.
Suspense does not detect data fetched in an Effect or event handler. Those flows need their own loading and failure handling, rather than relying on a Suspense fallback or Error Boundary to catch a fetch rejection. See React’s Suspense reference.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Rank #3
The Promise-with-use exception
React’s use API integrates a Promise read into rendering. While that Promise is pending, the component suspends and the nearest Suspense boundary supplies the loading fallback. If the Promise rejects, the nearest Error Boundary handles the rejection. The Promise passed to use must be cached so the same instance is reused across rerenders. React describes retrying with a replacement Promise and resetting the boundary, including through reset keys or a transition, in its use reference.
Do not wrap use in try/catch. React uses suspension to interrupt rendering; catching that internal control flow can lead to incorrect behavior. Use Suspense for the pending state and an Error Boundary for rejection.
Rank #4
Why try/catch around JSX does not catch a child render error
This parent does not catch an exception that occurs later while React renders Child:
function Parent() {
try {
return <Child />;
} catch (error) {
return <p>Could not render child</p>;
}
}
The JSX expression creates an element; it does not synchronously render the child inside the surrounding JavaScript try block. React’s error-boundaries lint documentation explains that render errors bubble through the component tree and should be handled with an Error Boundary.
Best Value
The documented startTransition exception
React lists event handlers and asynchronous code such as timer and animation callbacks among the contexts Error Boundaries do not catch, but documents an exception: errors thrown inside the function passed to startTransition from useTransition are caught. This exception is specific to that API; it does not make a boundary a general-purpose handler for every event or async failure. See the Component reference.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




