reactjs / reactjs/react.dev

clarify when componentDidUpdate fires

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

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

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

説明

Re-posting this issue from facebook/react:
https://github.com/facebook/react/issues/2796

https://reactjs.org/docs/react-component.html#componentdidupdate is unclear on when it is called with regards to the render function.

The docs state that it's "Invoked immediately after updating occurs" but it is unclear what is meant with updating in this case: it can refer to either the component as a whole updating (meaning post-render), or it can refer to setState() having been processed (which might mean pre-render).

It would be good to explicitly state when this function fires in its documentation (even if somewhere else on the site this is described in text or graphic form already).

There was a PR for this that was merged at one point: https://github.com/facebook/react/pull/2801

But the current website does not include this change. I believe the language from the above PR is still correct and would be helpful to people since it's more specific than what's there currently.

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

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

はじめの一歩

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

調査の方向性

Issue で引用されている React コンポーネントドキュメントの URL にある componentDidUpdate セクションから始め、現在の文言を facebook/react PR #2801 で参照されている表現と比較します。callback が rendering に対していつ実行されるかが明確になるようにドキュメントを更新し、公開されたページにその明確化が含まれていることを確認します。

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

評価

技術スタック
react
領域
documentation
issue の種類
ドキュメント
難易度
1/5
見積もり時間
1〜3時間
活発さ
停滞
明瞭さ
明確に書かれている
初心者へのやさしさ
50/100

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

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