[Suggestion]: Improve code in Tic-Tac-Toe demo
Offen
Dieses Issue hat noch niemand übernommen.
type: documentation
- Vorherrschende Sprache
- JavaScript
- Sterne
- 11.8k
- Forks
- 7.9k
- Ø Merge
- 1 T. 11 Std.
- Gemergte PRs (30 T.)
- 11
Beschreibung
Summary
I believe there's a good scope to improve the code in the Tic-Tac-Toe example here.
Page
https://react.dev/learn/tutorial-tic-tac-toe
Details
- The
Boardcomponent returns theSquarecomponent statically. This could instead be returned dynamically using themapmethod. This will also be a good way to demonstrate thekeyprop. - Talking about the styling, instead of defining a
board-rowclass that puts each box in a row, we can instead use a grid container with 3 columns andfit-contentwidth. - Instead of attaching a click listener to each box, the click event handling can be delegated to the parent container.
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 Tic-Tac-Toe-Tutorial unter https://react.dev/learn/tutorial-tic-tac-toe und überprüfe die Beispiele für Board, Square und Styling. Aktualisiere die Demo so, dass sie mit map Quadrate erzeugt und key demonstriert, ein dreispaltiges Raster verwendet und Klicks an den übergeordneten Container delegiert; das Tutorial sollte weiterhin verständlich und funktionsfähig bleiben.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- javascript, react
- Bereich
- documentation, frontend
- Issue-Typ
- Refactoring
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 45/100