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