July 2019
Intermediate to advanced
310 pages
7h 26m
English
Now that you’ve organized the salad state, you need to handle the contact-related state. You’ve seen the pitfalls of nested state. In this section, you will learn a different approach by using extensible records to create a Contact type without nesting state. Yet, you will still build a separate updateContact function that only changes contact-related fields.
You need to make a Contact type alias, but it will differ from the type aliases you’ve made previously. Below the Salad type alias, add this code:
| | type alias Contact c = |
| | { c |
| | | name : String |
| | , email : String |
| | , phone : String |
| | } |
This is an extensible record type. An extensible record resembles ...
Read now
Unlock full access