The Board component returns the Square component statically. This could instead be returned dynamically using the map method. This will also be a good way to demonstrate the key prop.
Talking about the styling, instead of defining a board-row class that puts each box in a row, we can instead use a grid container with 3 columns and fit-content width.
Instead of attaching a click listener to each box, the click event handling can be delegated to the parent container.
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
Board
component returns theSquare
component statically. This could instead be returned dynamically using themap
method. This will also be a good way to demonstrate thekey
prop.board-row
class that puts each box in a row, we can instead use a grid container with 3 columns andfit-content
width.