Composing Sagas
Use call to call another saga:
const saga = createSaga(async function() {
return 2;
});
const main = createSaga(async function() {
const result = await this.call(saga);
console.log(result); // 2
});
Use callFn to call another function:
const fn = () => 2;
const main = createSaga(async function() {
const result = this.callFn(fn);
console.log(result); // 2
});
Use callPromise to call another promise:
const promise = Promise.resolve(2);
const main = createSaga(async function() {
const result = await this.callPromise(promise);
console.log(result); // 2
});