squares: Array(9).fill(null)
}
],
- stepNumber: 0,
+ step_number: 0,
next_to_play: Team.X
};
}
squares: Array(9).fill(null)
}
],
- stepNumber: 0,
+ step_number: 0,
next_to_play: Team.X
});
}
receiveMove(i) {
- const history = this.state.history.slice(0, this.state.stepNumber + 1);
+ const history = this.state.history.slice(0, this.state.step_number + 1);
const current = history[history.length - 1];
const squares = current.squares.slice();
if (calculateWinner(squares) || squares[i]) {
squares: squares
}
]),
- stepNumber: history.length,
+ step_number: history.length,
next_to_play: next_to_play
});
}
}
}
- jumpTo(step) {
- this.setState({
- stepNumber: step,
- next_to_play: (step % 2) === 0
- });
- }
-
render() {
const history = this.state.history;
- const current = history[this.state.stepNumber];
+ const current = history[this.state.step_number];
const winner = calculateWinner(current.squares);
let status;