Created
May 19, 2016 20:43
-
-
Save chrislaskey/9955cb7561cf85573930378b2985dad9 to your computer and use it in GitHub Desktop.
Redux
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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