You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
583 B
Elm
32 lines
583 B
Elm
module Explore exposing (Msg(..), main, update, view)
|
|
|
|
import Browser
|
|
import Html exposing (Html, button, div, text)
|
|
import Html.Events exposing (onClick)
|
|
|
|
|
|
main =
|
|
Browser.sandbox { init = 0, update = update, view = view }
|
|
|
|
|
|
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 (String.fromInt model) ]
|
|
, button [ onClick Increment ] [ text "+" ]
|
|
]
|