Skip to content

Instantly share code, notes, and snippets.

@goldensunliu
Last active March 1, 2018 16:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save goldensunliu/d72244e8d4672f80d37eb3174859efc9 to your computer and use it in GitHub Desktop.
Save goldensunliu/d72244e8d4672f80d37eb3174859efc9 to your computer and use it in GitHub Desktop.
class Game extends Compoent {
...
getSelectedCell() {
const { board } = this.state;
const selected = board.get('selected');
return selected && board.get('puzzle').getIn([selected.x, selected.y]);
}
selectCell = (x, y) => {
let { board } = this.state
board = board.set('selected', { x, y })
this.setState({ selected: { x, y }, board})
}
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment