With redux-saga, one can execute multiple effects in parallel:
import { call } from 'redux-saga/effects'
// correct, effects will get executed in parallel
const [users, repos] = yield [
call(fetch, '/users'),
call(fetch, '/repos')
]
How can i create those "call"-calls programmatically?
What i want to achieve is this:
Lets say i have an array with different parameters and i want to execute a request to a server per parameter, but in parallel with redux-saga:
const parameters = ['abc', 'def', 'ghi']
const allMyFetchCalls = parameters.map( (p) => makeCallRequestWithParameter(p) );
makeCallRequestWithParameter would create a function call (or in redux-saga-speech: an effect) call(fetch, param) like in yield call(fetch, param)
const resultArray = yield allMyFetchCalls;
Is this possible and if so, how?