reactjs / reactjs/react.dev

Timing of effects

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

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

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

説明

Although useEffect is deferred until after the browser has painted, it's guaranteed to fire before any new renders. React will always flush a previous render's effects before starting a new update.

Is this true in both concurrent and non-concurrent mode. It would appear intuitively that these two call-sites in non-concurrent mode would be deterministic:

ReactDOM.render(<Foo>, container)
ReactDOM.render(<Foo>, container)

That is it would invoke a new render before the effect in the first render has been invoked.

If so would it make more sense to specify it is only in relation to effects i.e previous effects are guaranteed to run before future effects.

As it stands, it looks appears as though the "render" call-site is non-deterministic in non-concurrent.

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

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

はじめの一歩

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

調査の方向性

まず、エフェクトが新しいレンダーの前にフラッシュされるという、引用されたドキュメントの記述を確認し、その後、その文言を2か所のReactDOM.renderの呼び出し箇所、およびconcurrentとnon-concurrentの両方の動作と比較します。ドキュメントがサポートされる保証を明確に記載し、それがレンダー全般に適用されるのか、エフェクトの順序にのみ適用されるのかを明らかにできれば完了です。

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

評価

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

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

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