Expand on benefits of lifting state up and clarity on game state
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 11.8k
- Forks
- 7.9k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 11
Description
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!
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the “Completing the Game > Lifting State Up” section of the tutorial and review the paragraph quoted in the issue. Expand the explanation of why lifting state improves understandability, bug resistance, and refactoring, and clarify how the Square’s state relates to the game’s state. Done means the wording is clear to beginners and addresses both suggestions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100