use hook
Unanswered
Chinese Alligator posted this in #help-forum
Chinese AlligatorOP
I'm using the new use hook from React 19 with Next.js 15.3.2. In my server-side page, I'm doing the following:
The getUsers function throws an error like this:
When I try to wrap this with an ErrorBoundary, I get the following message:
I'm following the guidelines from the React documentation:
https://react.dev/reference/react/use#displaying-an-error-to-users-with-error-boundary
What's the correct way to use an ErrorBoundary when combining Server Components and Client Components? Is there a recommended pattern for catching and displaying errors that happen in server-side data fetching with use?
const usersPromise = getUsers();
<ErrorBoundary>
<Suspense fallback={<TableLoading />}>
<UsersTable usersPromise={usersPromise} />
</Suspense>
</ErrorBoundary>
The getUsers function throws an error like this:
throw new Error("simulated error");
When I try to wrap this with an ErrorBoundary, I get the following message:
An error occurred in the Server Components render. The specific message is omitted in production builds to avoid leaking sensitive details. A digest property is included on this error instance which may provide additional details about the nature of the error.
I'm following the guidelines from the React documentation:
https://react.dev/reference/react/use#displaying-an-error-to-users-with-error-boundary
What's the correct way to use an ErrorBoundary when combining Server Components and Client Components? Is there a recommended pattern for catching and displaying errors that happen in server-side data fetching with use?