Use for questions relating to The Elm Architecture, whether implemented in [elm] proper, or in the many implementations in other languages and on other platforms. Do NOT use this tag for questions relating to general architecture as applied to Elm code.
The Elm Architecture is an architectural pattern for developing user interfaces, similar to Model-View-Controller and the like, but distinguished primarily by being purely functional in nature. The pattern originates in elm but has since been adopted by libraries on many other languages and platforms.
The fundamental building blocks of The Elm Architecture are:
- The
Model-- comprising the state of your application - The
updatefunction -- a pure function from the current state to the next - The
viewfunction -- a pure function from a given state to HTML
update is triggered by events attached to the HTML in the view function and are accompanied by a message describing which event occurred. The update function will then, given the message and current state, return the next state, which is in turn passed on to view to render the state`s corresponding HTML.
update may also be triggered other non-user events such as commands and subscriptions, which might fetch data from the server or just emit trigger an update every second. These kinds of updates are also accompanied by appropriate messages, and follow the same flow as events triggered from HTML. They're just initiated elsewhere.