Skip to content

Instantly share code, notes, and snippets.

@vdanchenkov
Last active March 24, 2016 21:04
Show Gist options
  • Save vdanchenkov/a27d53dcf1f50197c98f to your computer and use it in GitHub Desktop.
Save vdanchenkov/a27d53dcf1f50197c98f to your computer and use it in GitHub Desktop.
You probably do not need redux-act to reduce boilerplate
const createAction = (type, payloadReducer = (i => i)) => {
const creator = (...args) => {
const payload = payloadReducer(...args);
return payload ? { type, payload } : { type };
};
creator.toString = () => type;
return creator;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment