Calling setState in componentDidUpdate
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 25/100
- Issue 类型
- 功能
- 描述清晰度
- 需要澄清
- 活跃度
- 停滞
- 技术栈
- eslint, javascript, react
调研方向
从链接的 react/no-did-update-set-state 规则文档和 React 的 componentDidUpdate 文档开始。确定 issue 提议对该规则或其指导内容做出什么更改,然后根据文档中说明的注意事项验证预期行为;完成这项工作需要确定范围并进行相应的项目更新。
由索引模型根据 Issue 内容生成。
描述
It might be worth revisiting react/no-did-update-set-state.
Now that componentWillReceiveProps() is being deprecated, componentDidUpdate() is the only "safe" way to detect changes in props and set state accordingly.
The React docs say calling setState() in componentDidUpdate() is permitted, albeit with caveats.
You may call setState() immediately in componentDidUpdate() but note that it must be wrapped in a condition like in the example above, or you’ll cause an infinite loop. It would also cause an extra re-rendering which, while not visible to the user, can affect the component performance.
- 主要语言
- JavaScript
- 星标
- 148k
- 派生
- 26.6k
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
airbnb/javascript 的其他 Issue
-
Severity: Unhandled promise rejection in `whitespace-async.js` when ESLint async path is used可能已有人在做 @bodapatisaikrishna 于 24 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
airbnb/javascript#3237 · 6 条评论 ·
-
Inconsistent semicolon usage in examples (Arrays vs Functions)可能已有人在做 @Developer-shivamMishra 于 14 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 68/100
airbnb/javascript#3152 · 4 条评论 ·
-
No error handling around execSync + JSON.parse in whitespace.js (ESLint 9 path)可能已有人在做 @dataCenter430 于 219 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 48/100
airbnb/javascript#3238 · 8 条评论 ·
-
Upgrading eslint-plugin-react-hooks可能已有人在做 @weihongyu12 于 364 天前认领。 未关闭
难度 3/5 1-2 天 新手友好度 38/100
airbnb/javascript#3186 · 3 条评论 · 2 个 reaction ·
-
难度 3/5 1-2 天 新手友好度 45/100
airbnb/javascript#3173 · 9 条评论 · 1 个 reaction ·
查看 airbnb/javascript 的全部 Issue
相似的 Issue
-
documentation
难度 1/5 1 小时以内 新手友好度 91/100
githubnext/gh-aw-workshop#4458 ·
维护者通常 1 天内回复
-
Add: Cartoonito未关闭check:failed feeds:add
难度 2/5 1-3 小时 新手友好度 63/100
iptv-org/database#37390 · 1 条评论 ·
维护者通常 9 天内回复
-
bug: directory index route root priority is overwritten when wildcard is false可能已有人在做 @TalhaHunter101 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 84/100
fastify/fastify-static#617 ·
-
agent/sec-check hive/hosted-available-lke648397-260827-5n31 security
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
factory-active factory-automatic task-bug-reproduction-success task-identify-harness-labels-done task-identify-issue-type-done
难度 2/5 1-3 小时 新手友好度 62/100
维护者通常 1 天内回复