[Suggestion]: Tic-tac-toe tutorial should explicitly explain that mutation causes unreliable re-rendering
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 11.8k
- Forks
- 7.9k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 11
Description
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.
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
Open the linked Tic-tac-toe tutorial at the “Why immutability is important” section and compare it with the referenced “Updating Objects in State” article. Update the tutorial to explain that direct mutation can prevent React from reliably detecting changes and re-rendering, then verify that the explanation fits the existing discussion of slice(), time travel, and performance.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 52/100