Created
March 8, 2018 23:26
-
-
Save mhanberg/f54f9f7486f116353ad9cbd2b734a856 to your computer and use it in GitHub Desktop.
elm-snippet-building-with-elm-at-sep-makes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Html exposing (Html, button, div, text) | |
import Html.Events exposing (onClick) | |
main = | |
Html.beginnerProgram { model = 0, view = view, update = update } | |
type Msg = Increment | Decrement | |
update msg model = | |
case msg of | |
Increment -> | |
model + 1 | |
Decrement -> | |
model - 1 | |
view model = | |
div [] | |
[ button [ onClick Decrement ] [ text "-" ] | |
, div [] [ text (toString model) ] | |
, button [ onClick Increment ] [ text "+" ] | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment