We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5695711 commit a491f21Copy full SHA for a491f21
src/index.js
@@ -34,6 +34,7 @@ class Game extends React.Component {
34
}
35
36
render() {
37
+ const MAX_LEN = 9;
38
this.history = this.state.history;
39
this.current = this.history[this.history.length-1];
40
this.winner = calculateWinner(this.current.squares); // Due Game Component now have the squares state this Component will calculateWinner.
@@ -46,10 +47,11 @@ class Game extends React.Component {
46
47
</li>
48
);
49
});
-
50
let status;
51
if (this.winner) {
52
status = 'Winner: ' + this.winner;
53
+ } else if (this.history.length-1 === MAX_LEN) {
54
+ status = 'Draw...';
55
} else {
56
status = 'Next Player: ' + (this.state.xIsNext ? 'X' : 'O');
57
0 commit comments