Skip to content

Instantly share code, notes, and snippets.

@denisraslov
Last active January 7, 2018 17:35
Show Gist options
  • Save denisraslov/68565c3ecf3b51f39f3af0d121312922 to your computer and use it in GitHub Desktop.
Save denisraslov/68565c3ecf3b51f39f3af0d121312922 to your computer and use it in GitHub Desktop.
import { getStore } from 'react/store';
const Task = Backbone.View.extend({
events: {
'click .saveName': function(e) {
const name = this.nameInput.value;
// Change the name of the task in the model
this.model.set('name', name);
// Then change it in the store
getStore().getState().dispatch({
action: 'CHANGE_TASK',
data: {
name
}
});
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment