Skip to content

Instantly share code, notes, and snippets.

@mattjbray
Last active May 11, 2016 08:36
Show Gist options
  • Save mattjbray/baa73435e9df6f984fabe9aad258f14a to your computer and use it in GitHub Desktop.
Save mattjbray/baa73435e9df6f984fabe9aad258f14a to your computer and use it in GitHub Desktop.
Elm 0.17 error after removing onClick
module Main exposing (..)
import Html.App as Html
import Html exposing (..)
import Html.Events exposing (..)
main : Program Never
main =
Html.beginnerProgram
{ model = 0
, update = update
, view = view
}
type Msg
= Inc
update : Msg -> Int -> Int
update msg count =
case msg of
Inc ->
count + 1
view : Int -> Html Msg
view count =
div
[]
[ p [] [ text ("Count: " ++ toString count) ]
, button
-- Remove the onClick handler when the count reaches 3.
(if count < 3 then [onClick Inc] else [])
[ text "Inc" ]
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment