I enjoy my code fairly explicit, so writing a button click that invokes some request has me writing:
- A click handler
- 3 new action name consts (request, success, failure)
- An action instantiation function that takes the necessary arguments for request.
- A saga function that catches these request actions, runs a request, and invokes the success action/failure action depending
- 3 handlers in my reducers. One for every action.
It all adds up if you have a ton of buttons :P
You might want to check out our new `redux-starter-kit` package [0], which can simplify some common use cases for things like action creators and reducers. There's also many other existing libraries to handle repetitive code like API requests as well [1].
[0] https://github.com/reduxjs/redux-starter-kit
[1] https://github.com/markerikson/redux-ecosystem-links/blob/ma... , https://github.com/markerikson/redux-ecosystem-links/blob/ma...
That said, thanks for the recommendations! I’ll check them out.
Also related, the new Redux FAQ entry on choosing between async middlewares: https://redux.js.org/faq/actions#what-async-middleware-shoul...
I'm not an expert by any means, but I wrote a fairly substantial react app recently, and I found that redux not only made this straightforward, but made it hard to do anything else. I did have to learn redux and redux- saga on top of react, but it wasn't hard.