Using redux-saga To Simplify Your Growing React Native Codebase
Steve Kellock
49711

What if we are yield ‘ing for one thing, but there is two possibilities, for instances:

function *hello() {
yield take('BEGIN_REQUEST')
yield put({ type: 'SHOW_WAITING_MODAL' })
const response = yield call(myApiFunctionThatWrapsFetch)
// what if response fails? then i want to show a error message in the modal
  yield put({ type: 'PRELOAD_IMAGES', response.images }) || 
yield put({ type: 'USAGE_TRACK', activity: 'API_CALL'})
yield put({ type: 'HIDE_WAITING_MODAL' })
}
Show your support

Clapping shows how much you appreciated Noitidart’s story.