Not that it's bad to let the user go back and forth to see what
happened, but the interface here was particularly clunky, (both for
being rendered as a list of buttons and also for allowing the user to
fire off new moves wen viewing old history state).
This commit simply guts the rendering of the "moves" list. It doesn't
yet remove the jumpTo code that's now dead.
const current = history[this.state.stepNumber];
const winner = calculateWinner(current.squares);
const current = history[this.state.stepNumber];
const winner = calculateWinner(current.squares);
- const moves = history.map((step, move) => {
- const desc = move ?
- 'Go to move #' + move :
- 'Go to game start';
- return (
- <li key={move}>
- <button onClick={() => this.jumpTo(move)}>{desc}</button>
- </li>
- );
- });
-
let status;
if (winner) {
status = "Winner: " + winner;
let status;
if (winner) {
status = "Winner: " + winner;
</div>
<div className="game-info">
<div>{status}</div>
</div>
<div className="game-info">
<div>{status}</div>