“Fixing the React ‘A component suspended’ Error”
In React 18, if you load the content of a tab or modal with lazy after a button click, the page can go blank and show the error "A component suspended while responding to synchronous input". Either place a <Suspense> above the component that is waiting to load, or wrap the state update from the button in startTransition. Either fix removes the error.
I reproduced this error in a test environment. I confirmed the message that appears, and I confirmed that both fixes remove it. I also confirmed that the error does not appear in the browser with React 19, but it does appear with renderToString, which builds HTML on the server.
The test environment was Ubuntu 24.04 and Node.js 22.23.4. I prepared two projects created with the react-ts template of npm create vite@latest (Vite 8.3.8, TypeScript 7.0.2). One used react and react-dom 19.3.1, and the other used 18.3.1 (@types/react 18.3.31). For the browser, I ran Chromium 153 with Playwright 1.63.0. For server rendering, I ran .tsx files directly with tsx 4.23.15. I did not test frameworks such as Next.js, or the pattern of reading a Promise with use.
The full error text in the console
With the React 18.3.1 dev server, pressing the button in the code below printed the following two messages in the DevTools console.
The above error occurred in one of your React components:
at Lazy
at div
at App (http://localhost:5174/src/App.tsx:12:26)
Consider adding an error boundary to your tree to customize error handling behavior.
Visit https://reactjs.org/link/error-boundaries to learn more about error boundaries.
Uncaught Error: 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.

The message means: "A component suspended (started waiting to load) while responding to synchronous input. This would replace the UI with a loading indicator. To fix it, wrap the update that causes the suspension in startTransition." The at Lazy in the first error is the component that was waiting.
In the production build, the message was shortened to Minified React error #426. The React error page for 426 contains the same text as above.
The code that caused the error
Pressing the button sets show to true, which renders Detail, a component loaded with lazy. To make the loading delay visible during testing, I delayed the import by one second with setTimeout. There is no <Suspense> above Detail.
import { lazy, useState } from 'react';
// A component that takes 1 second to load (delayed on purpose for testing)
const Detail = lazy(
() =>
new Promise<typeof import('./Detail')>((resolve) => {
setTimeout(() => resolve(import('./Detail')), 1000);
}),
);
export default function App() {
const [show, setShow] = useState(false);
return (
<div>
<button onClick={() => setShow(true)}>詳細を表示</button>
{show && <Detail />}
</div>
);
}
After pressing the button, everything on the page disappeared, including the button. The page was still empty 1.6 seconds later, which is after the one-second load finished. As the Error Boundary section of the Component reference explains, if you do not catch a rendering error with an Error Boundary, React removes the UI from the screen.
Looking at the react-dom 18.3.1 source, when a component suspends and there is no Suspense above it, React waits for the load to finish if the update is not synchronous. It throws this error only for synchronous updates (the comments call them sync/discrete updates). The comments give the reason: a synchronous update must finish building all of the screen at once so that it does not get out of step with external state. In my test, calling setShow directly in onClick caused the error, and wrapping it in startTransition, described below, did not.
Fix 1: Wrap in Suspense and show a loading state
Place a <Suspense> above the component that suspends, and pass the loading UI as fallback. Only the area around Detail changed.
import { lazy, Suspense, useState } from 'react';
// Same Detail definition as above
export default function AppSuspense() {
const [show, setShow] = useState(false);
return (
<div>
<button onClick={() => setShow(true)}>詳細を表示</button>
<Suspense fallback={<p id="loading">読み込み中…</p>}>
{show && <Detail />}
</Suspense>
</div>
);
}
With React 18.3.1, pressing the button produced no error. After 0.1 seconds the page showed the fallback text (Japanese in the code, meaning "Loading…"), and after 1.6 seconds it showed "Details loaded" (also Japanese in the code). The button stayed on the page.

This is the same pattern as the lazy reference's example of using lazy with Suspense. When a component suspends, the loading UI replaces only the content inside the nearest Suspense boundary. In the Suspense reference example, Suspense is placed near the root of the page, so the whole page layout is replaced by the loading UI. In my test, placing Suspense close to the component that suspends kept the button and the other parts of the page visible.
Fix 2: Wrap in startTransition and keep the current screen
If you do not want to show a loading UI, and you want to keep the current screen until loading finishes, wrap the state update from the button in startTransition.
import { lazy, startTransition, useState } from 'react';
// Same Detail definition as above
export default function AppTransition() {
const [show, setShow] = useState(false);
return (
<div>
<button
onClick={() => {
startTransition(() => {
setShow(true);
});
}}
>
詳細を表示
</button>
{show && <Detail />}
</div>
);
}
With React 18.3.1, pressing the button produced no error. After 0.1 seconds the page still showed only the button, with no change. After 1.6 seconds, "Details loaded" appeared.
An update wrapped in startTransition is treated as non-urgent. As the Suspense reference section on preventing unwanted fallbacks describes, React keeps the current screen and waits for the data to be ready. Because nothing seems to change after you press the button, use isPending from useTransition if you want to show that loading is in progress (see the useTransition reference on displaying a pending visual state).
Choose between them based on what you want to show while loading. Use Suspense if you want a loading UI in the new part of the screen. Use startTransition if you want to keep the screen that is already displayed.
In React 19's browser build, this error does not occur
I ran the same three code samples with React 19.3.1. The code without Suspense or startTransition did not produce an error. After pressing the button, the page still showed only the button at 0.1 seconds. At 1.6 seconds, "Details loaded" appeared. This matched the behavior of the version wrapped in startTransition.
When I searched the react-dom 19.3.1 files for synchronous input, the message appeared only in files whose names start with react-dom-server-legacy, which are the server-side files. In 18.3.1, the message was also in the browser file react-dom.development.js.
However, the absence of an error does not mean the page responds while loading. The screen does not change while the component is waiting. Even in React 19, you still use Suspense to show a loading UI, and isPending to show that loading is in progress.
The same error occurs with renderToString on the server
With both React 19.3.1 and 18.3.1, calling renderToString to build HTML threw an error with the same message if a component suspended outside a Suspense boundary.
import { renderToString } from 'react-dom/server';
// PageBroken is a component that renders the lazy Detail inside <main> without Suspense
console.log(renderToString(<PageBroken />));
Error: 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.
The server has no button press, so the message's advice to "wrap it in startTransition" does not apply here. There are two ways to fix it.
The first is to wrap Detail in <Suspense fallback={<p>読み込み中…</p>}>. The error went away, and the HTML contained the loading UI. (This is React 19.3.1's output. I shortened some of the long parts and attributes with "…".)
<main><h1>商品ページ</h1><!--$!--><template data-msg="…The server used "renderToString" which does not support Suspense. …" …></template><p>読み込み中…</p><!--/$--></main>
The renderToString reference also says that renderToString does not wait. It puts the fallback of the nearest Suspense boundary into the HTML. The content is displayed after the code loads in the browser.
The second is to switch to an API that waits for loading. If you want to generate static HTML in advance, React 19's prerender from react-dom/static works. When I passed the same component without Suspense, there was no error. After 1056 ms, it produced HTML with the content included.
import { prerender } from 'react-dom/static';
const { prelude } = await prerender(<PageBroken />);
console.log(await new Response(prelude).text());
<main><h1>商品ページ</h1><p id="detail">詳細を読み込みました</p></main>
The prerender reference says that, unlike renderToString, it waits for all data to load. If your server returns HTML for each request, the renderToString reference on migrating to a streaming method on the server is also useful.





