Functional components - is saving props in state a good idea?
未关闭
还没有人认领这个 Issue。
- 主要语言
- JavaScript
- 星标
- 11.8k
- 派生
- 7.9k
- 平均合并
- 1 天 11 小时
- 30 天内合并 PR
- 11
描述
After reading the available documentation, I'm still not sure if saving props in state in functional components is a good idea or not.
Could you please clarify if this is a valid pattern and how to implement it.
https://reactjs.org/docs/hooks-faq.html#how-do-i-implement-getderivedstatefromprops
https://reactjs.org/docs/hooks-effect.html#tip-optimizing-performance-by-skipping-effects
https://reactjs.org/blog/2018/06/07/you-probably-dont-need-derived-state.html
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先查看链接的 Hooks FAQ、Hooks Effect 和 derived-state 文档。确定关于在函数组件 state 中存储 props 的指导还缺少哪些内容,以及如何实现有效模式;当建议和实现指导足够清晰、无需读者自行推断答案时,文档就完成了。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- react
- 领域
- documentation
- Issue 类型
- 文档
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 需要澄清
- 新手友好度
- 25/100