reactjs / reactjs/react.dev

[Typo]: Client Components running on the server

Offen
#7,223 1 Kommentar 2 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

type: typos
Vorherrschende Sprache
JavaScript
Sterne
11.8k
Forks
7.9k
Ø Merge
1 T. 11 Std.
Gemergte PRs (30 T.)
11

Beschreibung

Summary

The "use client" docs state:

During render, the framework will server-render the root component and continue through the render tree, opting-out of evaluating any code imported from client-marked code.

The server-rendered portion of the render tree is then sent to the client. The client, with its client code downloaded, then completes rendering the rest of the tree.

This implies that Client Components are skipped during SSR, but I don’t think that’s true.

Page

https://react.dev/reference/rsc/use-client

Details

My understanding is that Client Components will render on the server during SSR, and hydrate on the client. This is necessary so that the server-generated HTML is complete; if Client Components were truly skipped during SSR, our HTML would be full of holes that would only be filled in after hydration.

Another way to verify this is to add a console.log() to a Client Component, within a component function. The log will be printed in our server terminal, showing that the code is indeed evaluated on the server.

It’s possible I'm misunderstanding what is meant by "render" in this context, but it really makes it sound like the server skips any files that are marked with "use client". And unless this changed very recently, it is demonstrably untrue.

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Lies die Referenzseite zu “use client” und die zitierten Passagen über serverseitiges Rendering und den Renderbaum. Überprüfe das beschriebene Verhalten anhand des Kontexts der verlinkten Dokumentation und der gemeldeten serverseitigen Konsolenausgabe. Als erledigt gilt die Überarbeitung der Formulierung, sodass sie Client Components während des SSR korrekt erklärt, ohne anzudeuten, dass als client markierter Code vollständig übersprungen wird.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
javascript, react
Bereich
documentation
Issue-Typ
Dokumentation
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
42/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.