Skip to content

Instantly share code, notes, and snippets.

@chrislaskey
Created May 19, 2016 20:43
Show Gist options
  • Save chrislaskey/9955cb7561cf85573930378b2985dad9 to your computer and use it in GitHub Desktop.
Save chrislaskey/9955cb7561cf85573930378b2985dad9 to your computer and use it in GitHub Desktop.
Redux
var reducer = (state = {}, action) => {
switch action.type {
case "CUSTOM_ACTION":
return merge({}, state, {value: action.value});
default:
state
}
}
var store = Redux.createStore(reducer);
store.subscribe((state) => console.log(state));
store.dispatch({value: "fire"});
// Inside the store calls:
// state = reducer(state, action);
// toSubscribers(state)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment