react-tic-tac-toe
react-tic-tac-toe copied to clipboard
Solution to the improvements in the tic-tac-toe game of React Tutorial.
According to the React documentation: > React may batch multiple setState() calls into a single update for performance. > > Because this.props and this.state may be updated asynchronously, you should...
The solution provided highlights the button if it matches the current move, i.e., the button is highlighted even if it hasn't been specifically clicked.
Much of my solution was similar to yours. When checking for a draw in CalculateWinner, I passed in the stepNumber and compared it with squares.length.