Reacting to a change in state, or to the action that provoke this change


I have a use case where I want to re-fetch data if my first call failed and I detect (via reachability) that I am now connected.

I have shared to my screen the network status, but if I want to react to it, I need to do it in my viewController, meaning that it won't be part of my core business logic.

an other way would be to listen to the action that notify about network status change from the reducer, but I don't react to a state change anymore.

I'm wondering what is the best way to handle effects that needs to run only when multiple changes have occurred in the state. (in my case, I'm in error state AND I have access back to the network)

In my case it could work with observing the action only, but what if we need to compose with more changes ?

Thank you in advance for your help.

1 Like