Last active
August 19, 2016 03:40
-
-
Save alyssaBiasi/c00f3c411a7385e5b773f182fc4b0884 to your computer and use it in GitHub Desktop.
REA Flux to Redux "Before" - http://rea.tech/singletons-suck-aka-flux-to-redux/
This file contains 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
class FeatureToggleStore extends MapStore { | |
getInitialState() { | |
return { featureToggles: {} }; | |
} | |
reduce(state, payload) { | |
const { action } = payload; | |
switch (action.type) { | |
case Actions.FEATURE_TOGGLES_UPDATED: | |
const featureToggles = { | |
...state.featureToggles, | |
...action.data | |
}; | |
return { featureToggles }; | |
default: | |
return state; | |
} | |
} | |
getFeatureToggles() { | |
return this.getState().featureToggles; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment