Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: where are client components rendered? #51606

Closed
gmoniava opened this issue Jun 21, 2023 · 3 comments
Closed

Docs: where are client components rendered? #51606

gmoniava opened this issue Jun 21, 2023 · 3 comments
Labels
Documentation Related to Next.js' official documentation. locked

Comments

@gmoniava
Copy link

What is the improvement or update you wish to see?

I am somewhat confused about one part in Nextjs docs.

At one place it says:

Client Components enable you to add client-side interactivity to your
application. In Next.js, they are pre-rendered on the server and
hydrated on the client

Then a little bit below it it says:

Components in the Client Component module graph are primarily rendered
on the client, but with Next.js, they can also be pre-rendered on the
server and hydrated on the client.

It seems the first quote is suggesting in Nextjs client components are always pre-rendered on the server and hydrated on the client, while the second one says they might be pre-rendered on the server and hydrated on the client (notice the bold text use of word "can" in the second quote).

Can someone clear up this confusion in the docs?

Is there any context that might help us understand?

N/a

Does the docs page already exist? Please link to it.

https://nextjs.org/docs/getting-started/react-essentials#client-components

@gmoniava gmoniava added the Documentation Related to Next.js' official documentation. label Jun 21, 2023
@gmoniava gmoniava changed the title Docs: Docs: where are client components rendered? Jun 21, 2023
@delbaoliveira
Copy link
Contributor

delbaoliveira commented Jun 22, 2023

Hey @gmoniava, apologies for the confusion. With Next.js, client components are pre-rendered on the server and hydrated on the client. It's the same behaviour that the /pages router has by default.

For the second sentence:

Components in the Client Component module graph are primarily rendered on the client

This is the React behavior, without Next.js.

but with Next.js, they can also be pre-rendered on the server and hydrated on the client.

This is the Next.js optimization, on initial load.

But I can see how that is not very clear.

I'm updating the React Essentials page here if you have any further feedback: #51579

@gmoniava
Copy link
Author

gmoniava commented Jun 22, 2023

My point was it seems both quotes which I cited suggest something like this: "In Next.js, they are pre-rendered on the server and
hydrated on the client". However, the second quote seems to use the word "can" which the first quote doesn't. That's why I was confused - it felt those two quotes didn't say the same thing.

I see that PR plans to address some items like:

Explain how Server Components are different from SSR and Hydration
Explain how Client Components are pre-rendered in Next.js

This is good because I had question about the first one myself for example. You can see others are interested in the first one too.

@github-actions
Copy link
Contributor

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Documentation Related to Next.js' official documentation. locked
Projects
None yet
Development

No branches or pull requests

2 participants