how does one call a saga from within another saga?
Asked Answered
I

1

14

When using redux-connect (the @asynConnect attribute) how does one chain a second saga, that is dependent on a successful completion of the first saga?

Just simply putting the saga dispatch action in at the appropriate location in the first saga works on the client, but not on the server.

Inky answered 20/3, 2017 at 0:8 Comment(1)
I was having the same struggle. I just found this, it saved my job : github.com/redux-saga/redux-saga/issues/984Elissaelita
T
17

Calling a saga from another saga is as simply as doing a call effect.

yield call(firstSaga, params);

For example:

yield call(firstSaga);

//do something in current saga with whatever you save
//from the first saga in redux store

const data = select(firstSagaSelector);

yield call(myApi, data);
Tractile answered 7/11, 2017 at 9:50 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.