clarify when componentDidUpdate fires
還沒有人認領這個 Issue。
- 主要語言
- JavaScript
- 星號
- 11.8k
- 分支
- 7.9k
- 平均合併
- 1 天 11 小時
- 30 天內合併 PR
- 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.
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
從 issue 中引用的 React 元件文件 URL 的 componentDidUpdate 區段開始,然後將其目前的措辭與 facebook/react PR #2801 中所參照的表述進行比較。更新文件,明確說明 callback 相對於渲染的執行時機,並確認已發布的頁面包含這項澄清。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- react
- 領域
- documentation
- Issue 類型
- 文件
- 難度
- 1/5
- 預估耗時
- 1-3 小時
- 活躍度
- 停滯
- 描述清晰度
- 描述清楚
- 新手友好度
- 50/100