TL;DR
In the previous post, we learned how to create Elm Record Model. Let’s add Elm View
to our Picshare
application. This post is part of the functional language series, and it is based on a remarkable book, Programming Elm Build Safe and Maintainable Front-End Applications by Jeremy Fairbank.
Elm View
Elm View is responsible for displaying the Elm Record Model. It is tempting to put a state into Elm View. But as these could lead to many application problems and issues, Elm View is only responsible for displaying the Elm Record Model.
In step 1.
we created an application view
that accepts our initialModel
and returns Elm Virtual DOM
. We pass that model
to viewDetailedPhoto
the function that is using model url
and caption
attributes. In step 4
we set application main
variable to use view.
Compile the application and open index.html
.
We have Elm stateful application with View
and Record Model.
Remember
- How To Create Elm View
- Elm View only purpose is to display the Elm Record Model
Comments are closed.