Skip to content

[Suggestion]: Tic-tac-toe tutorial should explicitly explain that mutation causes unreliable re-rendering #8086

@sam77777777777

Description

@sam77777777777

Summary

The tutorial's Why immutability is important section doesn't clearly state that mutating state causes unreliable re-rendering behavior.

Page

https://react.dev/learn/tutorial-tic-tac-toe#why-immutability-is-important

Details

While following the tic-tac-toe tutorial, I was confused about why .slice() is necessary. The "Why immutability is important" section talks about time travel features and performance optimizations, but it never explains that mutating the array directly will cause React to not reliably detect the change, meaning the component may not re-render.

It seems as though that is the primary reason the tutorial uses .slice(), but it's not mentioned. I only found this explanation later in the "Updating Objects in State" article. It would be helpful to include this explanation in the tutorial where beginners first encounter the pattern.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions