Free tools Windows power users keep installed
One-click scans. No signup required.
Use a React Error Boundary to recover a specific part of the interface when a descendant fails during rendering. Use browser global handlers to report certain uncaught JavaScript errors and unhandled Promise rejections. They cover different situations: a global handler does not provide a React fallback, and a boundary does not catch every JavaScript failure.
How the two mechanisms differ
| Failure or task | React Error Boundary | Browser global handler |
|---|---|---|
| A descendant throws while React renders | Yes. The boundary can show fallback UI and report the error through componentDidCatch. |
React says a boundary-caught error bubbles to window in development, but not in production. It is not a dependable production reporting path for errors a boundary handles. React Component reference |
| An event handler throws synchronously | No. Handle the failure in the handler or its action flow. | If it escapes uncaught, it can trigger the browser error event. That reports the exception; it does not replace the affected React UI. MDN: Window error event |
A setTimeout or requestAnimationFrame callback throws |
Generally no; these callbacks run outside the ordinary render handling. | An uncaught synchronous exception can reach the global error event. MDN: Window error event |
| A Promise rejects without a rejection handler | Generally no, unless surfaced through a React-supported path such as a rejected Promise read with use(promise). |
The relevant event is unhandledrejection. Some cross-origin rejections do not fire it. MDN: Window unhandledrejection event |
| An image, script, or other resource fails to load | Not an ordinary descendant-rendering failure. | The error event can be dispatched on the failed element, so a listener on window is not a universal resource-failure detector. MDN: Window error event |
| The boundary itself throws | No. A boundary does not catch errors thrown by itself. | A resulting uncaught synchronous exception may reach the global handler, depending on how it escapes. React Component reference |
| Server-side rendering fails | Ordinary Error Boundary guarantees do not cover server-side rendering. Streaming Suspense has separate server behavior. | Browser window handlers do not handle server execution; server-runtime error handling is separate. React Component reference |
What a React Error Boundary catches—and what it does not
An Error Boundary is a React component that handles errors thrown by its descendant components while React renders them. It can switch the affected part of the tree to fallback UI instead of leaving that part of the page in its failed state. This makes boundaries a recovery tool scoped to the interface.
React documents several exclusions: event handlers, server-side rendering, errors thrown by the boundary itself, and most asynchronous callbacks. An error in a click handler or timer therefore needs handling in that handler or callback rather than reliance on a nearby boundary. React Component reference
Two React-supported paths for errors and rejections
There are specific cases that reach a boundary beyond an ordinary render-time throw. React documents that errors in the function passed to useTransition‘s startTransition can reach an Error Boundary. React useTransition reference
#1 Best Overall
- Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
- Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
- Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
- Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
- 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
A rejected Promise read using React’s use(promise) also reaches the nearest Error Boundary. The Promise must be cached so the same Promise is read across renders; creating a new Promise each render can cause problems. React use reference
Where to place boundaries
Put a boundary where it makes sense to replace a failed area with fallback UI—for example, around a conversation list or an individual message. A boundary around the entire app may offer a final fallback, but more local boundaries let unaffected parts of the interface remain available. Wrapping every component mechanically is not necessary.
Rank #2
- 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
- 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
- Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
- 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
- What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
What browser global handlers observe
Browser global handling addresses errors that escape to the global execution scope; it does not create a React fallback or repair a failed component tree. The two relevant browser events describe different kinds of failure:
errorreports synchronous script errors that reach the global scope. Resource-loading errors can instead be dispatched on the failed element.unhandledrejectionreports a Promise rejection for which no rejection handler was attached. Some cross-origin rejections do not trigger the event.
These events are not interchangeable. A Promise rejection is not a synchronous script exception, so listen for unhandledrejection when reporting unhandled Promise failures. MDN: Window error event MDN: Window unhandledrejection event
Rank #3
- Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
- Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
- Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
- Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
- What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
addEventListener("error", ...) versus window.onerror
With window.addEventListener("error", callback), the callback receives an event object. The historical window.onerror property instead receives five arguments. MDN notes an unusual rule for that property: returning true suppresses the browser’s default console report, but does not resume the failed script. Avoid suppressing the default report unless you deliberately want to take over that behavior. MDN: Window error event
For unhandledrejection, calling preventDefault() suppresses the default reporting behavior. Do so only if your code intentionally assumes responsibility for reporting the rejection. MDN: Window unhandledrejection event
Rank #4
- Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
- Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
- Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
- Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
- Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft
How to report boundary errors in React
The documented class-boundary pattern uses static getDerivedStateFromError to select fallback state. Use componentDidCatch(error, info) to log details; info.componentStack contains the component stack.
React does not currently offer a direct function-component equivalent for componentDidCatch. Its reference points to the react-error-boundary package as an alternative for function-component-oriented use. React Component reference
The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Best Value
- 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
- Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
- Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
- HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
- What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
React 19 root callbacks
React 19 adds onCaughtError and onUncaughtError root options alongside onRecoverableError. The first is for errors React catches in an Error Boundary; the second is for errors not caught by a boundary. These callbacks depend on configuring the React root, and provide reporting hooks rather than replacing a boundary’s local fallback UI. React 19 release notes
Quick Recap
Choose the handling point that matches the failure
- A component fails while rendering: put an Error Boundary around the part of the UI that should recover, and report it through
componentDidCatchor a React 19 root callback. - An event handler or callback fails: handle errors where the action runs. A global
errorlistener can report an uncaught synchronous exception, but cannot supply local React recovery. - A Promise rejection is expected: attach a rejection handler and handle the failure in the relevant async flow. Do not leave it unhandled just to rely on a global event.
- A Promise rejection reaches React through
use(promise)or the documented transition path: use a boundary to provide the UI fallback. - A failure reaches the browser globally: use
errorfor uncaught synchronous script errors andunhandledrejectionfor unhandled Promise rejections. Treat these as diagnostics, not as a substitute for recovery.
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.

