Returning promises
None of the action creator functions we've looked at so far in this chapter have returned any values. That's because their main job is to dispatch actions, while at the same time hiding any concurrency synchronization semantics. On the other hand, action creator functions could return a promise so that we could compose more complex asynchronous behavior that spans multiple stores. In the last section, we saw that composing asynchronous behavior using action creator functions can be difficult if not impossible to do.
In this section, we'll revisit the challenges posed by asynchronous behavior in the context of composing larger functionality. Then, we'll create an example implementation with action creators that return promises ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access