简体   繁体   中英

Run Redux action only when two other actions were triggered

I have specified two Redux actions called FETCH_PROFILE and FETCH_CATEGORIES that run independently on application startup.

Is it possible, ie using Redux Saga, to run third action INITIALIZE_APP but only when both of above have been triggered?

In this case I'd not rely on the state change directly.

Sure, just use the all effect.

yield all([
  take(FETCH_PROFILE),
  take(FETCH_CATEGORIES),
])
yield put({type: INITIALIZE_APP})

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM