[Suggestion]: Tic-tac-toe tutorial should explicitly explain that mutation causes unreliable re-rendering
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- JavaScript
- Sterne
- 11.8k
- Forks
- 7.9k
- Ø Merge
- 1 T. 11 Std.
- Gemergte PRs (30 T.)
- 11
Beschreibung
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.
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Öffne das verlinkte Tic-tac-toe-Tutorial im Abschnitt „Why immutability is important“ und vergleiche es mit dem referenzierten Artikel „Updating Objects in State“. Aktualisiere das Tutorial, um zu erklären, dass direkte Mutation React daran hindern kann, Änderungen zuverlässig zu erkennen und erneut zu rendern, und überprüfe anschließend, dass die Erklärung zur bestehenden Diskussion über slice(), Time Travel und Performance passt.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- javascript, react
- Bereich
- documentation
- Issue-Typ
- Dokumentation
- Schwierigkeit
- 1/5
- Geschätzter Aufwand
- Unter einer Stunde
- Aktivitätsstatus
- Veraltet
- Klarheit
- Klar beschrieben
- Anfängerfreundlichkeit
- 52/100