Skip to content

Instantly share code, notes, and snippets.

@thiskevinwang
Last active February 6, 2019 21:36
Show Gist options
  • Save thiskevinwang/def9e7d7e9ce84f5f046c5465855ebea to your computer and use it in GitHub Desktop.
Save thiskevinwang/def9e7d7e9ce84f5f046c5465855ebea to your computer and use it in GitHub Desktop.
// 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