File tree Expand file tree Collapse file tree 1 file changed +19
-14
lines changed Expand file tree Collapse file tree 1 file changed +19
-14
lines changed Original file line number Diff line number Diff line change 1
1
purescript-react
2
2
================
3
3
4
- React Bindings for PureScript
4
+ React Bindings for PureScript.
5
+
6
+ ** WARNING:** This is alpha quaility software and you need to use [ nightly build
7
+ of React] [ nightly ] .
5
8
6
9
``` haskell
7
10
module Main where
8
11
9
12
import React
10
- import qualified React.DOM as DOM
13
+ import React.DOM
11
14
12
15
hello = mkUI spec do
13
16
props <- getProps
14
- return $ DOM. h1 {
15
- className: " Hello"
16
- } [
17
- DOM. text " Hello, " ,
18
- DOM. text props. name
17
+ return $ h1 [
18
+ className " Hello"
19
+ ] [
20
+ text " Hello, " ,
21
+ text props. name
19
22
]
20
23
21
24
incrementCounter = do
@@ -24,15 +27,17 @@ incrementCounter = do
24
27
25
28
counter = mkUI spec { getInitialState = return 0 } do
26
29
val <- readState
27
- return $ DOM. p {
28
- className: " Counter" ,
29
- onClick: handle incrementCounter
30
- } [
31
- DOM. text (show val),
32
- DOM. text " Click me to increment!"
30
+ return $ p [
31
+ className " Counter" ,
32
+ onClick incrementCounter
33
+ ] [
34
+ text (show val),
35
+ text " Click me to increment!"
33
36
]
34
37
35
38
main = do
36
- let component = DOM. div {} [hello {name: " World" }, counter {}]
39
+ let component = div {} [hello {name: " World" }, counter {}]
37
40
renderToBody component
38
41
```
42
+
43
+ [ nightly ] : http://react.zpao.com/builds/master/latest/react.js
You can’t perform that action at this time.
0 commit comments