stop the game

This commit is contained in:
Paul Trowbridge 2021-04-18 23:17:02 -04:00
parent d3f8ad21a1
commit bdc27a1e46

View File

@ -21,6 +21,9 @@ function Square(props){
handleClick(i) { handleClick(i) {
const squares = this.state.squares.slice(); const squares = this.state.squares.slice();
if (calculateWinner(squares) || squares[i]) {
return;
}
squares[i] = this.state.xIsNext ? 'X' : 'O'; squares[i] = this.state.xIsNext ? 'X' : 'O';
this.setState( this.setState(
{ {