I'm in the process of converting some sagas to thunks. Some of these sagas have nested generator functions that I'm not able to call within thunks. Normally in a saga I do:
const result = yield call(myFunction, anotherSaga, params);
However when i try to convert this to thunk like:
export const myAction = createAsyncThunk(
'myAction',
async (data: Payload, { dispatch, getState }) => {
const result = myFunction(anotherSaga, params).next().value;
console.log(result)
})
console:
@@redux-saga/IO: true
combinator: false
payload: {context: null, args: Array(2), fn: ƒ}
type: "CALL"
I don't get anything usable as anotherSaga
has nested sagas. How can I convert this to a thunk function?