Most Elm applications are built using a pattern called The Elm Architecture (TEA). If you have used Redux, this architecture will be very familiar. This is not a coincidence – Redux was heavily inspired by Elm!
This is the Elm architecture:
view
function.view
function renders the current model to produce our program’s user interface (typically as HTML).ExpandDetails
.update
function, passing in the message and the current model.update
function returns an updated model, and optionally a list of side effects to run (➐).view
function again to render our interface with the updated model. It also performs any side effects requested by our program.Concept | Elm | Redux |
---|---|---|
Application state | Model | State |
Application events | Message | Action |
Function that transforms the state | Update | Reducer |