How should we read values from an Effect
in the future.
#1925
-
So I decided to live on the edge and try to migrate my codebase to |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Hey @notcome! Conflating Once you keep this dichotomy in mind, the conversion is simple: The publisher of events becomes an async sequence of events, and your reducer can iterate over this sequence of events to produce actions for the store. There is an example of such conversion in To sum up, pre- If you encounter issues while modernizing your codebase, feel free to post a few problematic bits, so we can provide more specific orientations! Footnotes
|
Beta Was this translation helpful? Give feedback.
Hey @notcome! Conflating
Effect
withPublisher<_, Never>
is a byproduct ofEffect
being based onPublisher
. Ideally, your dependencies should produce somePublisher<Output, Failure>
. In other words, the dependency doesn't produce anEffect
, it produces aPublisher
of events. Your reducer can then use this publisher to transform this sequence of events into a sequence ofAction
s (that is, anEffect
). You can't really read values from anEffect
because anEffect
isn't strictly speaking something that produces values1. This is something that is expressed by theStore
.Once you keep this dichotomy in mind, the conversion is simple: The publisher of events becomes an async sequence of events, …