Skip to content

Instantly share code, notes, and snippets.

@EECOLOR
Last active November 12, 2015 22:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EECOLOR/b76f566bedf748c9c42a to your computer and use it in GitHub Desktop.
Save EECOLOR/b76f566bedf748c9c42a to your computer and use it in GitHub Desktop.
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 */ };
}
@EECOLOR
Copy link
Author

EECOLOR commented Nov 12, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment