Skip to content
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: 18 comments 40 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
22 replies
@alexbaileyuk
Comment options

@gaearon
Comment options

@gaearon
Comment options

@SorooshGb
Comment options

@gaearon
Comment options

Answer selected by ryandotelliott
Comment options

You must be logged in to vote
6 replies
@P233
Comment options

@Hachikoi-the-creator
Comment options

@DaehoKwag
Comment options

@juliansommer
Comment options

@nicolas-zozol
Comment options

Comment options

You must be logged in to vote
2 replies
@panddr
Comment options

@gaearon
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
1 reply
@JSONRice
Comment options

Comment options

You must be logged in to vote
2 replies
@jrnxf
Comment options

@joeshub
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@ARBS-23
Comment options

@kkirby
Comment options

Comment options

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

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@hainguyents13
Comment options

@mcfry
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
1 reply
@inducingchaos
Comment options

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