Last active
November 12, 2015 22:34
-
-
Save EECOLOR/b76f566bedf748c9c42a to your computer and use it in GitHub Desktop.
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
const ACTION = 'my-app/widgets/ACTION'; | |
export default function reducer(state = {}, action = {}) { | |
switch (action.type) { | |
case ACTION: | |
return action.reduce(state) | |
default: | |
return state; | |
} | |
} | |
export function loadWidgets() { | |
return { type: ACTION, reduce: state => /* reduce stuff */ }; | |
} | |
export function createWidget(widget) { | |
return { type: ACTION, reduce: state => /* reduce stuff */ }; | |
} | |
export function updateWidget(widget) { | |
return { type: ACTION, reduce: state => /* reduce stuff */ }; | |
} | |
export function removeWidget(widget) { | |
return { type: ACTION, reduce: state => /* reduce stuff */ }; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Based on https://github.com/erikras/ducks-modular-redux