Last active
February 6, 2019 21:36
-
-
Save thiskevinwang/def9e7d7e9ce84f5f046c5465855ebea to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Inside Game's render method | |
// Note <button>'s child | |
const moves = history.map((step, move) => { | |
const desc = move | |
? "Go to move #" + move + " @ " + history[move].location | |
: "Go to game start"; | |
return ( | |
<li key={move}> | |
<button onClick={() => this.jumpTo(move)}> | |
{move == this.state.stepNumber ? <b>{desc}</b> : desc} | |
</button> | |
</li> | |
); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment