#Understanding server & client component

15 messages · Page 1 of 1 (latest)

muted galleon
#

if i use "use client" in parent component in next.js, do child components also treated as client component?

golden cometBOT
#

🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize

✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)

ripe quartz
#

No.

#

You can interleave server and client components.

muted galleon
golden cometBOT
#
✅ Success!

This question has been marked as answered! If you have any other questions, feel free to create another post

Jump to answer

[Click here](#1280012241931993258 message)

ripe quartz
teal oriole
#

well, I have a diferent view from @ripe quartz
in Next.js, if you use "use client" in a parent component, all child components will also be treated as client components. The "use client" directive indicates that the component should be rendered on the client side, and this behavior propagates down to its children.

ripe quartz
#

This is not a matter of opinion. Children of client components can still be server components as they are prerendered on the server and slotted in afterwards. They don't miraculously become client components with their usual set of features just because a parent component is a client component, they are still server components after all.

muted galleon
#

here is the screenshot from docs.

golden cometBOT
#
✅ Success!

This question has been marked as answered! If you have any other questions, feel free to create another post

Jump to answer

[Click here](#1280012241931993258 message)

#
✅ Success!

This question has been marked as answered! If you have any other questions, feel free to create another post

Jump to answer

[Click here](#1280012241931993258 message)

cold sapphire
golden cometBOT
#
✅ Success!

This question has been marked as answered! If you have any other questions, feel free to create another post

Jump to answer

[Click here](#1280012241931993258 message)

cold sapphire
#

Btw you can only mark one message as solution so I remarked to the one most deserving