Last active
March 24, 2016 21:04
-
-
Save vdanchenkov/a27d53dcf1f50197c98f to your computer and use it in GitHub Desktop.
You probably do not need redux-act to reduce boilerplate
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 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