Clarify why useEffect() may need exhaustive deps
まだ誰も着手していません。
- 主要言語
- JavaScript
- スター
- 11.8k
- フォーク
- 7.9k
- 平均マージ
- 1日 11時間
- マージ済み PR(30日)
- 11
説明
I may be having a... moment, but in Conditionally firing an effect, is this sentence accurate?
If you use this optimization, make sure the array includes all values from the component scope (such as props and state) that change over time and that are used by the effect. Otherwise, your code will reference stale values from previous renders.
Doesn't useEffect capture the latest props and state the moment any of its dependencies change? What can happen is the effect misses some updates when things it references change and they're not included as deps, but when it does run the props and state are "fresh" (pertaining to the latest render), are they not?
(Edit: removed unrelated point)
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
リンク先の「Conditionally firing an effect」セクションから始め、component scope の値について述べた文を、文書化されている useEffect の依存関係の動作と照らし合わせて確認してください。参照されている値を依存関係配列から省略した場合に何が起こるのかを、その文言が正確に説明できていれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- javascript, react
- 領域
- documentation
- issue の種類
- ドキュメント
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 45/100