Documentation about Keys beyond usage in lists
还没有人认领这个 Issue。
- 主要语言
- JavaScript
- 星标
- 11.8k
- 派生
- 7.9k
- 平均合并
- 1 天 11 小时
- 30 天内合并 PR
- 11
描述
The You Probably Don't Need Derived State post shows a pattern that uses the key prop to reset (force remount) elements in order to restart the component lifecycle: https://reactjs.org/blog/2018/06/07/you-probably-dont-need-derived-state.html#recommendation-fully-uncontrolled-component-with-a-key
It would be good to expand on that example in the main docs and discuss some of the pitfalls of that approach (for example, if a component is not written to account for changing data sources, the consumer must add a key to correctly reset the component).
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从链接的“ You Probably Don’t Need Derived State”文章及其使用 key 的完全非受控组件示例开始。在 React 主文档的相关章节中加入一个可比的示例,并解释重置行为以及更改数据源时可能遇到的问题;当读者能够清楚理解其用法和注意事项时,即视为完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- javascript, react
- 领域
- documentation
- Issue 类型
- 文档
- 难度
- 2/5
- 预计耗时
- 半天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 48/100