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 11purescript-react
22================
33
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 ] .
58
69``` haskell
710module Main where
811
912import React
10- import qualified React.DOM as DOM
13+ import React.DOM
1114
1215hello = mkUI spec do
1316 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
1922 ]
2023
2124incrementCounter = do
@@ -24,15 +27,17 @@ incrementCounter = do
2427
2528counter = mkUI spec { getInitialState = return 0 } do
2629 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!"
3336 ]
3437
3538main = do
36- let component = DOM. div {} [hello {name: " World" }, counter {}]
39+ let component = div {} [hello {name: " World" }, counter {}]
3740 renderToBody component
3841```
42+
43+ [ nightly ] : http://react.zpao.com/builds/master/latest/react.js
You can’t perform that action at this time.
0 commit comments