News for hackers. Stuff that matters.
Re:Understanding redux-saga: From action creators to sagas by mikewhy on Thursday October 12, 2017 @01:08PM (#15459483)
Agreed, not sure what this gives over redux-promise-middleware, which lets you write things like:

    function myAction () {
      return {
        type: 'MY_ACTION',
        payload: someApiCall(),
      }
    }
And that will dispatch `MY_ACTION_PENDING`, then `MY_ACTION_FULFILLED` or `MY_ACTION_REJECTED`. Soon you'll be able to write your payload as an `async function`:

    function myAction () {
      return {
        type: 'MY_ACTION',
        async payload (dispatch) {
          const apiResult = await someApiCall()

          dispatch(anotherActionCauseWhyNot(apiResult))

          return apiResult
        }
      }
    }
I'm sure there's more to redux-saga, but this article doesn't do a great job of presenting that.
Re:Understanding redux-saga: From action creators to sagas by cnp on Thursday October 12, 2017 @03:46PM (#15460743)
The library helps manage complex, concurrent in-flight workflows. Games are a great example of this, or something like a flight booking app that communicates with many different processes and servers and you need to ensure that fine-grained control is maintained at all times.