3 ms·
Doing API calls inside async action creators / thunks _is_ entirely valid - in the end, it's still "creating actions". Just a question of how much duplication
by acemarke 10y ago
Doing API calls inside async action creators / thunks _is_ entirely valid - in the end, it's still "creating actions". Just a question of how much duplication you want to deal with, consolidation, etc.
But yeah, middleware is a concept that isn't talked about as much, but on the flip side, there's dozens and dozens of middlewares people have created. In fact, there's at least a couple dozen middlewares I've seen _just_ for doing AJAX calls. See my list at https://github.com/markerikson/redux-ecosystem-links/blob/master/middleware.md https://github.com/markerikson/redux-ecosystem-links/blob/ma... .
- davidjnelson 10y agoAnd thunks for async get even sweeter with async/await/await*!