Skip to content

Commit 5da88e1

Browse files
committed
example: event handler for pure component
1 parent 624a714 commit 5da88e1

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

example/app.purs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
module Main where
22

3+
import Debug.Trace
34
import React
45
import qualified React.DOM as DOM
56

7+
helloInConsole = do
8+
props <- getProps
9+
trace ("Hello, " ++ props.name ++ "!")
10+
611
hello = mkUI do
712
props <- getProps
813
return $ DOM.h1 {
9-
className: "Hello"
14+
className: "Hello",
15+
onClick: handle helloInConsole
1016
} [
1117
DOM.text "Hello, ",
1218
DOM.text props.name

example/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<html>
33
<head>
44
<style>
5-
.Counter {
5+
.Counter, .Hello {
66
cursor: pointer;
77
user-select: none;
88
-webkit-user-select: none;

0 commit comments

Comments
 (0)