Skip to content

Props must be serializable for components in "use client" file #46795

Answered by shuding
DeveloperRyan asked this question in Help
Discussion options

You must be logged in to vote

You should remove "use client" from child.tsx.

A "use client" directive means that component is a boundary between server and client components. Since parent.tsx is already inside the client boundary, everything imported will be client components already. And that includes child.tsx.

Why there's this warning? Since it's a boundary, you can potentially use it in a server component. However it's not allowed to have props that can't be serialized in that case. If you import child.tsx and render it inside a server component, there's no way to pass a function as the prop.

So this warning also suggests that you should not add "use client" to every client component, but only those boundaries tha…

Replies: 8 comments 19 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@shriharip
Comment options

Comment options

You must be logged in to vote
14 replies
@ADTC
Comment options

@wouter173
Comment options

@ss-joy
Comment options

@ADTC
Comment options

@eluchsinger
Comment options

Answer selected by DeveloperRyan
Comment options

You must be logged in to vote
3 replies
@hungcrush
Comment options

@P233
Comment options

@Hachikoi-the-creator
Comment options

Comment options

You must be logged in to vote
1 reply
@panddr
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet