Content deleted Content added
→Features: I think this should be "latter" rather than "later". |
|||
Line 64:
Those are the core of the Elm Architecture.
For example, imagine an application that displays a number and a button that increments the number when pressed.<ref>{{Cite web|title=Buttons · An Introduction to Elm|url=https://guide.elm-lang.org/architecture/buttons.html|access-date=2020-10-15|website=guide.elm-lang.org}}</ref> In this case, all we need to store is one number, so our model can be as simple as <code>type alias Model = Int</code>. The <code>view</code> function would be defined with the <code>Html</code> library and display the number and button. For the number to be updated, we need to be able to send a message to the <code>update</code> function, which is done through a custom type such as <code>type Msg = Increase</code>. The <code>Increase</code> value is attached
In the Elm Architecture, sending messages to <code>update</code> is the only way to change the state. In more sophisticated applications, messages may come from various sources: user interaction, initialization of the model, internal calls from <code>update</code>, subscriptions to external events (window resize, system clock, JavaScript interop...) and URL changes and requests.
== Limitations ==
|