Created
February 5, 2018 10:26
-
-
Save selbekk/2baf95672117808167d6db6233a73232 to your computer and use it in GitHub Desktop.
Action creator creators!
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
import Case from 'case'; | |
export const createAction = name => ({ | |
[Case.constant(name)]: Case.constant(name), | |
[Case.camel(name)]: payload => ({ | |
type: Case.constant(name), | |
payload, | |
}), | |
}); | |
export const createNetworkAction = name => ({ | |
...createAction(`${name}Requested`), | |
...createAction(`${name}Received`), | |
...createAction(`${name}Failed`), | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment