Skip to content

Instantly share code, notes, and snippets.

@hecrj
Created May 16, 2018 21:58
Show Gist options
  • Save hecrj/0109624ded453bbedca03a733f1ba1e2 to your computer and use it in GitHub Desktop.
Save hecrj/0109624ded453bbedca03a733f1ba1e2 to your computer and use it in GitHub Desktop.
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