How to send multiple effects from the same action

I have an action that when sent I want to trigger more than one effect.

It's supposed to start a couple of animations so It's basically a wait x seconds do something, wait y seconds do something else.

I know I can merge effects but they would essentially become one in the end and they would have to map to a single action. But what I really want to do is to return two Effects, one for each action.

What's the correct way of dealing with this?

Are you able to map on the effect before merging? that way you could route each effect to a different action:

case .someAction:
  return .merge(
    effect1
      .map(Action.effect1Response)
      .eraseToEffect(),

    effect2
      .map(Action.effect2Response)
      .eraseToEffect()
  )

Yeah that definitely works. I guess I must have misunderstood how .merge worked

Terms of Service

Privacy Policy

Cookie Policy