-
-
Notifications
You must be signed in to change notification settings - Fork 15.2k
How can I reduce this async action/reducer boilerplate pattern? #1661
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
As a first observation, you shouldn't be creating new Dates in your reducers, as that makes them non-deterministic. Beyond that, if you look at my Redux addons catalog, there's many utilities out there that do various things related to async actions - generating them, tracking status, etc. Might be something that fits your use case. |
@abrkn this looks a lot similar to your use case: https://github.com/spalger/async-redux-actions. |
Thanks for suggestions. I'm also looking into yelouafi/redux-saga |
I would start by generating reducers. |
@abrkn, the amount of code to write for asynchronous actions/reducers is just insane, so have a look at redux-act-async which provide 2 functions: |
you can create new date in your action creators and then get it in your reducer |
Since this is a usage question and there isn't anything actionable here, I'm going to close the issue. Feel free to discuss further if needed. Also, note that I'm currently working on a new documentation page about reducers over in #1784 , which may wind up covering a bit of this. |
I have thousands of lines along the lines of:
The above example is the simplest case. In other cases there are updates with more complicated optimistic concurrency.
The text was updated successfully, but these errors were encountered: