Handling network requests
The area where RxJS really excels is in handling side-effects. Given that an Observable is a stream of values that arrive over time, this implies asynchronicity. That makes RxJS a perfect fit for managing async state and data flows, such as complex network communication. In this recipe, we’re going to explore the most advanced and sophisticated ways of handling different network request scenarios.
How to do it…
In this example, we will build a small cooking recipe app, where we will load a list of recipes from the mocked BE (using MSW) and show them in the list. Then after clicking on a specific recipe, we will show that recipe on a new page with more details, which will require another layer of communication with the BE to fetch those details.
Step 1 – Handling requests in sequence
Let’s say we have two different endpoints. One that holds information about the recipe, and the other one only contains details for...