I have a component with an HTML form which I am filling and then sending data through the effect file (and a service) to the backend. What I need is to call another function inside the component once the effect file has done its part. I don't need to save anything in the reducer - I just need to know whether effect function (and service) did their job successfully.
The only way of achieving this from my point of view is saving that boolean (or whatever type) to reducer so that the component would register it and bringing back the default value right away.
So, in my effect file I'd do something like this:
this.store.dispatch(new CreationSuccessful(true));
setTimeout(() => this.store.dispatch(new CreationSuccessful(false)), 200);
And in the component I'd register this true value being fired off, which would be enough to call what I need to call.
Any other way of doing this, avoiding the reducer?
Just like in an effects class, you can listen to actions via the Actions
subject inside your component.
So, when the effect dispatches an action, you could "catch" it inside your component.
See a github issue for more info.