What You Learned
And…that’s a wrap. You achieved a lot in this chapter. You parsed static and dynamic URL paths with the Url.Parser module. Then, you used the Browser.application function along with the Elm Architecture to access the browser’s current URL and convert it into a route and page. You built components and updated their state through the Elm Architecture. Finally, you used your components to display different pages depending on the current page state.
The duplication code smell still remains in setNewPage and update. Wiring up each component leads to extremely similar code. As a challenge, create a helper function that sets the model’s page field with the appropriate Page constructor and page component model, and maps the command ...
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