News for hackers. Stuff that matters.
Re:Roadmap to becoming a React developer in 2018 by Murkin on Saturday July 07, 2018 @02:56AM (#17477432)
Surprised that redux-thunk is still alive in 2018, the cause of much of the most complicated and "ugly" code in Redux.

Time to move to custom middleware(s)

Re:Roadmap to becoming a React developer in 2018 by acemarke on Saturday July 07, 2018 @10:53AM (#17478719)
Why do you say that thunks are "the cause of complicated and ugly code" ?

I'm a Redux maintainer, and I recommend thunks as the default choice for async logic. Most people just need to make some AJAX calls and dispatch an action when it returns, or maybe grab a value from the store state and work with it. Thunks are perfect for that kind of use case - complex synchronous logic, and simple async. In fact, with `async/await` syntax, I would be a bit more comfortable doing somewhat more complicated async logic in a thunk as well.

I wrote a post a while back discussing some common objections to using thunks (and sagas), and why I feel thunks and sagas are still good choices for handling logic in Redux apps: https://blog.isquaredsoftware.com/2017/01/idiomatic-redux-th...

That said, yes, you should always feel free to write custom middleware to solve your own use cases.

Re:Roadmap to becoming a React developer in 2018 by fineng123 on Saturday July 07, 2018 @05:22AM (#17477788)
You can use saga if it feeds your ego, sure. Redux is a simple tool and thunk is a simple library, and they both do their job.