[Suggestion]: Document using Promises passed from RSC to the client without `use()`
まだ誰も着手していません。
- 主要言語
- JavaScript
- スター
- 11.8k
- フォーク
- 7.9k
- 平均マージ
- 1日 11時間
- マージ済み PR(30日)
- 11
説明
Summary
The docs on RSC should mention whether Promises passed from Server Components can be used without use().
Page
https://react.dev/reference/rsc/server-components
Details
Currently, the docs only discuss resolving Promises passed from the server using use(). Sometimes it can be useful to render a component with partial data and update its state once the promise is fulfilled. This appears to work.:
"use client";
export default function Component({ promise }) {
const [data, setData] = useState(null);
useEffect(() => {
let canceled = false;
promise.then((d) => !canceled && setData(d));
return () => canceled = true;
}, [promise])
return (<p>{data}</p>);
}
However I can't find any mentions of this use case. I think that if this is officially supported, there should be an example showing how to do it. And if not, that should be explicitly stated.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
https://react.dev/reference/rsc/server-components の Server Components ページから始め、client components に渡される Promises について現在どのように説明されているかを確認します。示されているユースケースが公式にサポートされているかどうかを判断し、例を使って文書化するか、サポートされていないことを明示します。ページでこのユースケースが明確に扱われれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- javascript, react
- 領域
- documentation
- issue の種類
- ドキュメント
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100