Last active
May 11, 2016 08:36
-
-
Save mattjbray/baa73435e9df6f984fabe9aad258f14a to your computer and use it in GitHub Desktop.
Elm 0.17 error after removing onClick
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 (..) | |
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