Next.js Discord

Discord Forum

Why client component prerender data from useState if this 'client'?

Answered
Somali posted this in #help-forum
Open in Discord
SomaliOP
Maybe I misunderstood the difference between server and client components, but for me, client components are like regular react, that is, if I click "watch sourcecode" , then I won't see the rendered data there, since they are drawn after executing js, respectively, I I don't understand why this code executes the prerender.
I've read the documentation for the server and client components, but it doesn't say anything about it.
Can you explain to me in more detail?
Answered by aardani
Its an improvement and is part of the features of Next.js Client components are prerendered in the server so that the use of client components would not affect SEO
View full answer

5 Replies

Its an improvement and is part of the features of Next.js Client components are prerendered in the server so that the use of client components would not affect SEO
Answer
The part where client components are run in the server are only the initial state of the client components. If you have side effects, those will be run in the client as per usual.
@aardani Its an improvement and is part of the features of Next.js Client components are prerendered in the server so that the use of client components would not affect SEO
SomaliOP
so i can use clients component anywhere and it won't be a performance issue or something else?
@Somali so i can use clients component anywhere and it won't be a performance issue or something else?
If you use them in moderation, yeah. but it depends on your use case and which performance metrics you care the most