Last active
October 15, 2015 14:59
-
-
Save glortho/55d87023e1e7cda5a199 to your computer and use it in GitHub Desktop.
Use decorators for dispatching actions in Flux - https://gist.github.com/jedverity/b3e3a06761daefeca110
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
// Note: examples below use https://gist.github.com/jedverity/b3e3a06761daefeca110 | |
class MyActionCreator { | |
@dispatch('SOME-ACTION') | |
updateStore(data) { | |
return data; // this will be dispatched with 'SOME-ACTION' as the actionType | |
} | |
@dispatch('SOME-ASYNC-ACTION') | |
postData(data) { | |
return MyApi.post('/url', data ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment