Further explanation about why side-effects should be limited to useEffect
まだ誰も着手していません。
- 主要言語
- JavaScript
- スター
- 11.8k
- フォーク
- 7.9k
- 平均マージ
- 1日 11時間
- マージ済み PR(30日)
- 11
説明
There are multiple recommendations about when side-effects are okay and when they are not okay; it is difficult to memorize them all, so it would be helpful if some further explanation is added explaining exactly why useEffect should be exclusively used for side effects e.g.
https://github.com/reactjs/reactjs.org/blob/master/content/docs/hooks-effect.md#example-using-classes-example-using-classes
For traditional life-cycle hooks, the reasoning is that some of them might be called multiple times before the render is committed; is the same applicable to hooks?
Thanks!
p.s. This comment seems relevant:
https://github.com/reactjs/reactjs.org/issues/302#issuecomment-345445888
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
リンクされている Hooks Effect ドキュメントのセクションから始め、クラスのライフサイクルメソッドについての説明を、副作用と useEffect に関する現在のガイダンスと比較します。副作用を useEffect に置くべき理由を明確に説明するようドキュメントを更新し、同じ繰り返し呼び出しへの懸念が hooks にも当てはまるかどうかを扱います。個別のルールを暗記しなくても推奨事項を理解できれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- javascript, react
- 領域
- documentation
- issue の種類
- ドキュメント
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 48/100