There's no functional difference, as Mateusz Burzyński (redux-saga maintainer) explains here:
Under the hood they are both the same, yield [...effects]
will result in a deprecation warning though and inform you about all
.
This was introduced to make parallel behaviour explicit and it nicely mirrors Promise.all
It's preferred to use all()
as it informs the reader that we're yielding more than 1 effect here, but the various uses of yield will still work without it:
yielding an object with multiple effects
const { company, profile } = yield {
company: select(getCompany),
profile: select(getUserProfile, userId),
};
yielding an array literal
yield [
put(userRequestSucceeded(userId)),
put(userReceived(response.data)),
];
yielding an array using map
yield userIds.map(userId => call(fetchUserDetails, userId));
Promise.all([...])
andPromise.resolve([...])
– Ignominyredux-saga
thing. – Xenocryst