Next.js Discord

Discord Forum

'use client' ""area of effect""

Answered
Australian Freshwater Crocodile posted this in #help-forum
Open in Discord
Australian Freshwater CrocodileOP
I already spoke about this with a mod, and read the documentation, but reading other mod's answers to other user got me doubting again.

The docs say:

[... by defining a "use client" in a file, all other modules imported into it, including child components, are considered part of the client bundle - and will be rendered by React on the client.]

// IMPORTED components
From that, i get that Svr. components imported into Client components basically become client components. But is that "so on an so forth" for the grandchildren?
Q1: If that first Svr. component had other server components imported, did those also become client side?

// components through PARAMS
Now from a mod answer, i understand that, contrary to "imported components" - "children" (let assume server) components do not become client when warped by a client component. Q2: Is that the case?
I'm not sure because judging by other mod's answer on another thread i understand they do become client side.
Q3: Similar to Q1, If they (children params) do become client side, do sub-children of that children also do?

I might be making a mess with text so i will try to explain this visually just in case.
First pic attached would be the code. Second pic is the possible results that ends up in. Q4: Which one is it?
(There are more combinations so, if none of those are correct please let me know)
Answered by aardani
If that first Svr. component had other server components imported, did those also become client side?
yes.
if the first SC is imported to a client component, all the imported SC inside the first SC is ACTED as a client component.

Is that the case?
I'm not sure because judging by other mod's answer on another thread i understand they do become client side.
SC thats passed through CC's children does not become client.
Q3 is irrelevant since children dont become client side

Q4: Result 3 (not 1 sorry)
View full answer

3 Replies

If that first Svr. component had other server components imported, did those also become client side?
yes.
if the first SC is imported to a client component, all the imported SC inside the first SC is ACTED as a client component.

Is that the case?
I'm not sure because judging by other mod's answer on another thread i understand they do become client side.
SC thats passed through CC's children does not become client.
Q3 is irrelevant since children dont become client side

Q4: Result 3 (not 1 sorry)
Answer
This is my notes about Server Components and Client Components if you want to read more about it in simpler terms
https://nextjs-forum.com/post/1151553108778954892#message-1153468901439578123
@aardani This is my notes about Server Components and Client Components if you want to read more about it in simpler terms https://discord.com/channels/752553802359505017/1151553108778954892/1153468901439578123
Australian Freshwater CrocodileOP
Awesomee, thanks for all the answers ! finally getting this confirmed is great.
Also thanks for the notes 👌 very helpful