Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

When an API request fails, show a clear failure state rather than leaving users with an unexplained empty area. Keep loading and error states separate, and provide a retry when the request can reasonably be attempted again. In React, the right mechanism depends on where the failure occurs: ordinary request failures belong in the fetch flow, while errors thrown during rendering can be handled by an Error Boundary.

Why a blank area is the wrong failure state

An empty panel does not tell someone whether data is still loading, whether there is no data, or whether the request failed. Model those outcomes distinctly: show a pending state while work is in progress, the content when it succeeds, and a failure message if it does not. A useful error state should identify the content that could not be loaded and, where appropriate, let the user try again.

React’s documentation does not publish a statistic for how often API errors cause blank screens or quantify the effect of error-state UI on user outcomes. The case for a deliberate state is practical: it makes the application’s current condition visible and gives users a next step when recovery is possible.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Which React mechanism handles the failure?

Failure or data mechanism What to use What to expect
A request started in an Effect or event handler Track the request’s status in its own state or use the corresponding mechanism in your data-fetching library. Render pending, success, and failure UI from that request flow. Suspense does not automatically detect fetching in Effects or event handlers. React Suspense documentation
An error thrown while React renders a descendant Place an Error Boundary above the subtree that should be replaced. The nearest Error Boundary handles eligible rendering errors in its descendants. A parent’s ordinary try/catch around JSX does not catch an error thrown later as React renders a child. React error-boundaries lint guidance
A Suspense-enabled source is still pending Wrap the relevant content in a Suspense boundary with a fallback. The fallback represents suspended work while it is pending; it is not a universal API error handler. React Suspense documentation

Show request failures in the request flow

For a conventional fetch started in an Effect or event handler, handle its outcome in that request’s state or data-fetching layer. Render the pending state while the request is underway and a distinct error state after failure. The specific state shape depends on the application; React’s Suspense documentation establishes the limitation for Effect- and event-handler-based fetching, but does not prescribe one universal state model.

#1 Best Overall
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • 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.

Do not expect adding <Suspense> around a component to make an ordinary Effect-based request show a loading fallback or an API error automatically. Suspense is for work that suspends through a supported mechanism. Its fallback handles pending work, not every rejected request.

Use an Error Boundary for rendering errors

An Error Boundary catches eligible errors thrown while React renders its descendant tree, including errors from descendant components and hooks. Put it around the area that should be replaced if rendering fails. React’s lint guidance states: “Try/catch blocks can’t catch errors that happen during React’s rendering process.” A try/catch in a parent that surrounds <Child /> cannot catch an error thrown later when React renders that child. React error-boundaries lint guidance

Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 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.

The boundary’s location determines the failure scope. A boundary around a single data panel can leave navigation and other page controls available; a boundary higher in the tree can replace a larger portion of the interface. React documents nearest-boundary behavior, but the right hierarchy depends on which surrounding parts should remain usable. The component reference describes Error Boundary behavior and implementation options. React Component reference

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Make retry a real recovery action

A retry should start fresh work, not merely dismiss the message while leaving the failed result in place. When a rendering error is handled by a boundary, recovery may also require resetting that boundary so React can render the subtree again. React’s use documentation illustrates a rejected-Promise flow with a “Try again” action and a changed key to reset the boundary. That is an example for supported Promise-reading code, not the only valid retry architecture. React use reference

Rank #3
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 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.

For a request managed in an Effect, handler, or data-fetching layer, connect the control to a new request and update that flow’s state. Offer retry only where another attempt is sensible; the error message should still make the failed content clear if the user cannot retry or chooses not to.

Account for streaming server rendering

Streaming server rendering has a separate recovery path from an API call that fails after the page has loaded. If a component errors while React streams server-rendered HTML, React can render the nearest Suspense fallback in the server output and retry that component on the client. If it errors again on the client, the nearest Error Boundary determines the visible error UI. Errors in the shell have separate server handling. React renderToPipeableStream reference

Rank #4
Sale
UGREEN USB C Hub 5 in 1 Multiport USB Adapter 4K HDMI, 100W Power Delivery
  • 5 in 1 Connectivity: The USB C Multiport Adapter is equipped with a 4K HDMI port, a 100W USB C PD port, a 5 Gbps USB A data port, and two 480 Mbps USB A ports

For a client-side request failure after initial rendering, use the request’s own failure handling; do not treat the streaming behavior as though it were the same event.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Choose the failure scope deliberately

  • One panel: Use a local request error state or a boundary around that panel when the rest of the page should remain usable.
  • A larger route or application area: Place the boundary higher only when that broader section should be replaced on a rendering error.
  • Pending work: Use a Suspense fallback only when the data source suspends through a supported mechanism; it does not replace the request’s own error handling for an Effect or event-handler fetch.
  • Retry: Ensure another attempt actually starts work and that any relevant failed boundary or request state is reset.

React also documents how transition failures can be presented through an Error Boundary in the useTransition reference. The boundary should still match the part of the interface that needs to recover.

Best Value
Anker USB C Hub, USB Extender, 4-in-1 USB Splitter, Computer Accessories
  • Ultra-Fast Data Transfers: Experience the power of 5Gbps transfer speeds with this USB hub and sync data in seconds, making file transfers a breeze.
  • Long Cable, Endless Convenience: Say goodbye to short and restrictive cables. This USB hub comes with a 2 ft long cable, giving you the freedom to connect your devices exactly where you need them.
  • Sleek and Compact: Measuring just 4.2 × 1.2 × 0.4 inches, carry the USB hub in your pocket or laptop bag and connect effortlessly wherever you go.
  • Instant Connectivity: Anker USB-C data hub offers a true plug-and-play experience, instantly connecting your devices and enabling seamless file transfers.
  • What You Get: 2ft Anker USB-C Data Hub (4-in-1, 5Gbps) , welcome guide, our worry-free 18-month warranty, and friendly customer service.

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.