Next.js Discord

Discord Forum

Error: Functions cannot be passed directly to Client Components unless you explicitly expose...

Answered
Polish posted this in #help-forum
Open in Discord
PolishOP
I am just passing fallback component to Errorboundary and the error occurred.. marking it as "use server" also introduced other errors.
Answered by joulev
if you do need error and resetErrorBoundary, you have to use ErrorBoundary in a client component, using the interleave pattern https://nextjs.org/docs/app/building-your-application/rendering/composition-patterns#interleaving-server-and-client-components
View full answer

11 Replies

@Polish I am just passing fallback component to Errorboundary and the error occurred.. marking it as "use server" also introduced other errors.
<ErrorBoundary fallback={<Fallback />}>
  ...
</ErrorBoundary>

if you don't need error and resetErrorBoundary
if you do need error and resetErrorBoundary, you have to use ErrorBoundary in a client component, using the interleave pattern https://nextjs.org/docs/app/building-your-application/rendering/composition-patterns#interleaving-server-and-client-components
Answer
dont use use server here
PolishOP
yea i try that it works but i want to make specific section on my app to have a reset button when error occur
that's why i entend to use FallbackComponent
PolishOP
ok thanks man ill check this out.. 👌
PolishOP
i tried passing the <Suspense/> and the RSC as a child of a client component that also wrapped by ErrorBoundary..
and this error show up
PolishOP
oops i did'nt see that 😅 .. its working now thank you bro..