Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module ClickCounter where
- import Prelude
- import Component as C
- import Pux.Html as H
- import Pux.Html.Events as E
- import Data.Generic (class Generic)
- type State = Int
- data Action = Click
- derive instance genericAction :: Generic Action
- initialState :: State
- initialState = 0
- component :: ∀ e. C.PuxComponent Action State e
- component = C.Simple update view
- where
- update Click s = s + 1
- view s = H.div [] [
- H.strong [] [H.text "Count your clicks"],
- H.div [] [H.text $ "you have clicked " ++ show s ++ " times."],
- H.button [E.onClick $ const Click] [H.text "click"]
- ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement