-
-
Save hecrj/0109624ded453bbedca03a733f1ba1e2 to your computer and use it in GitHub Desktop.
This file contains 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
module Main exposing (main) | |
import Browser | |
import Html exposing (Html, text, button, div) | |
import Html.Events exposing (onClick) | |
-- Compile with --debug flag | |
type alias Model = | |
Bool | |
initialModel : Model | |
initialModel = | |
False | |
type Msg | |
= Toggle | |
update : Msg -> Model -> Model | |
update msg model = | |
not model | |
view : Model -> Html Msg | |
view model = | |
if model then | |
div [] [ text "Whoops" ] | |
else | |
div [] [ text "Hello", button [ onClick Toggle ] [ text "I should disappear when you click me" ] ] | |
main : Program () Model Msg | |
main = | |
Browser.sandbox | |
{ init = initialModel | |
, view = view | |
, update = update | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment