Skip to content

Instantly share code, notes, and snippets.

@ramonvictor
Last active April 27, 2016 20:22
Show Gist options
  • Save ramonvictor/25c7dbcb159ab5e07fd3516c2096658a to your computer and use it in GitHub Desktop.
Save ramonvictor/25c7dbcb159ab5e07fd3516c2096658a to your computer and use it in GitHub Desktop.
this.$table.addEventListener('click', function(event) {
var state = store.getState();
// [Prevent dispatch under certain conditions]
// Otherwise, trigger `SET_X` or `SET_O`
store.dispatch({
type: state.turn === 'x' ? 'SET_X' : 'SET_O',
index: parseInt(index, 10)
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment