Skip to content

Expand on benefits of lifting state up and clarity on game state #2167

Description

@micahwierenga

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions