Reputation: 137
I have a timeout, which prints tick
in console with 1000ms delay. This timeout start by action TICK
. How can I dispatch another action with redux-saga just after timeout?
Upvotes: 1
Views: 270
Reputation: 41913
If your saga, lets call it SagaA
listens to the TICK
action, you could use an effect called delay
, so the next action will be dispatched with a timeout.
function* sagaA() {
yield take('TICK');
yield delay(1000);
yield put(/* your action */); // will be fired 1s after `TICK` was dispatched
}
Upvotes: 3