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 5755e5e commit 5695711Copy full SHA for 5695711
src/index.js
@@ -38,6 +38,15 @@ class Game extends React.Component {
38
this.current = this.history[this.history.length-1];
39
this.winner = calculateWinner(this.current.squares); // Due Game Component now have the squares state this Component will calculateWinner.
40
41
+ const moves = this.history.map((step, move) => {
42
+ const desc = move ? 'Go to move #' + move : 'Go to game start';
43
+ return (
44
+ <li>
45
+ <button onClick={() => this.jumpTo(move)}>{desc}</button>
46
+ </li>
47
+ );
48
+ });
49
+
50
let status;
51
if (this.winner) {
52
status = 'Winner: ' + this.winner;
@@ -55,6 +64,7 @@ class Game extends React.Component {
55
64
</div>
56
65
<div className="game-info">
57
66
<div>{status}</div>
67
+ <ol>{moves}</ol>
58
68
59
69
60
70
);
0 commit comments