July 2019
Intermediate to advanced
310 pages
7h 26m
English
So far, you’ve used a single photo in the application, but it really should have many photos. In this section, you’ll update the application to display multiple photos. You will learn how to search lists in a model and add error handling to the API calls from the previous chapter.
In order to fetch multiple photos, you need to change the model to use a list of photos. First, create a helpful type alias for a list of photos called Feed:
| | type alias Feed = |
| | List Photo |
Then, replace the photo field in Model and initialModel with a feed field that has the type Maybe Feed:
| | type alias Model = |
| | { feed : Maybe Feed } |
| | initialModel = |
| | { feed = Nothing } |
Next, ...
Read now
Unlock full access