A React component suspended while rendering, but no fallback UI was specified.
React JavaScript Library
Severity: MinorWhat it means
React 17 and older: A React component suspended while rendering, but no fallback UI was specified. Add a
React 18 words it differently, when an update from a click or other direct input suspends with no boundary: A component suspended while responding to synchronous input. This will cause the UI to be replaced with a loading indicator. To fix, updates that suspend should be wrapped with startTransition. (#426)
React 19 raises no error for this. The update waits, and nothing new shows until the data is ready.
A component suspends while it waits, for example for a React.lazy() component to load.
Affected Models
- React 16.6 and later
How to Fix It
-
Wrap the waiting part in a Suspense boundary: <Suspense fallback={<p>Loading...</p>}> around it. Import Suspense from react.
-
A lazy component? The Suspense has to be above where it renders, not inside the lazy component itself.
-
The #426 form, after a click or another update? Wrap that state update in startTransition. React's docs: React then keeps showing the content already on screen while the new part loads.
-
React 19, nothing new shows and there is no error? A component may be waiting with no Suspense above it. Add the boundary the same way.