Most of the epics will begin by matching one action, for example. action$.ofType(SOMETHING)
. This is because usually these actions cause some side effect (for example, an AJAX call) that is specific to a single task.
Think of something like getting a user model. Usually you want to listen to FETCH_USER
to start this process, but, of course, the same epic can listen to other actions to know when to cancel flight requests or similar.
If you mix side effect problems in one epic style, for example, create one that handles both a user selection and a selection of user messages, you begin to make your epic words more difficult to maintain and test.
All of the above, there are no rules. There are legal (but rare) cases for epic listening to several actions in order to start some kind of side effect. for example, if an epic handles some general task that applies to multiple domains, the entry is most obvious, but there are others.
Like reducers, several epics can listen to the same action, but this only makes sense when a little coordination is required between them.
source share