Skip to content

Instantly share code, notes, and snippets.

@narendrashetty
Last active June 15, 2016 06:43
Show Gist options
  • Save narendrashetty/1b18092ea6bb7f18500a39d32a1416c5 to your computer and use it in GitHub Desktop.
Save narendrashetty/1b18092ea6bb7f18500a39d32a1416c5 to your computer and use it in GitHub Desktop.
const action = {
type, // specify the action type
data // optional data can be passed
};
Store.prototype.dispatch = function(action) {
// based on the action type
// generate a new state of the application,
// by passing it to a reducer
const state = this.reducer(action);
this.state = state;
// Brodcast the new state to all subscribers
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment