reactjs / reactjs/react.dev

[Typo]: Client Components running on the server

オープン
#7,223 コメント 1 件 リアクション 2 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

type: typos
主要言語
JavaScript
スター
11.8k
フォーク
7.9k
平均マージ
1日 11時間
マージ済み PR(30日)
11

説明

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.

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

「use client」のリファレンスページと、サーバーレンダリングおよびレンダーツリーに関する引用箇所を読んでください。リンク先のドキュメントの文脈と、報告されたサーバー側のコンソール出力を使って、説明されている挙動を検証してください。完了条件は、client とマークされたコードが完全にスキップされることを示唆せずに、SSR 中の Client Components を正確に説明するよう文言を修正することです。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
javascript, react
領域
documentation
issue の種類
ドキュメント
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
42/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。