Expand on benefits of lifting state up and clarity on game state
还没有人认领这个 Issue。
- 主要语言
- JavaScript
- 星标
- 11.8k
- 派生
- 7.9k
- 平均合并
- 1 天 11 小时
- 30 天内合并 PR
- 11
描述
Thank you for this fantastic tutorial! I had a couple suggestions, or clarifying questions regarding the following paragraph under Completing the Game > Lifting State Up:
We may think that Board should just ask each Square for the Square's state. Although this approach is possible in React, we discourage it because the code becomes difficult to understand, susceptible to bugs, and hard to refactor. Instead, the best approach is to store the game's state in the parent Board component instead of in each Square. The Board component can tell each Square what to display by passing a prop, just like we did when we passed a number to each Square.
In the second sentence, reasons are listed for lifting the state up, but it'd be incredibly helpful to have examples of these reasons expanded on, even if that expansion is found outside the tutorial. Because this is for beginners, they'll likely not know why these are valid reasons.
Also, in the sentence that begins, "Instead, the best approach..." it seemed confusing to refer to the "game's state" when the seeming antecedent to this is the square's state (first sentence). I would've expected the sentence to read, "Instead, the best approach is to store the Square's state in the parent Board component." Even though the lowercase in "game's" should make it obvious that the author doesn't have the Game component in mind, it still made it hard to discern the intent since the Square's state and the game's state hadn't been equated. Hope that makes sense!
Thank you again for this incredible tool!
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从教程的“Completing the Game > Lifting State Up”部分开始,查看 issue 中引用的段落。扩展关于提升 state 为什么能改善可理解性、抗 bug 能力和重构的说明,并阐明 Square 的 state 与游戏的 state 之间的关系。当措辞对初学者清晰易懂并涵盖两条建议时,即视为完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- javascript, react
- 领域
- documentation
- Issue 类型
- 文档
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 45/100