Skip to content

Commit 25081dc

Browse files
committed
Simplify example in README
1 parent a64c0c6 commit 25081dc

File tree

2 files changed

+11
-19
lines changed

2 files changed

+11
-19
lines changed

Diff for: README.md

+9-17
Original file line numberDiff line numberDiff line change
@@ -29,32 +29,24 @@ import Prelude
2929
import Control.Monad.Eff
3030
3131
import React
32-
import React.DOM
3332
34-
hello = mkUI (spec unit) \ctx -> do
35-
props <- getProps ctx
36-
return $ h1 [ className "Hello"
37-
]
38-
[ text "Hello, "
39-
, text props.name
40-
]
33+
import qualified React.DOM as D
34+
import qualified React.DOM.Props as P
4135
4236
incrementCounter ctx e = do
4337
val <- readState ctx
4438
writeState ctx (val + 1)
4539
4640
counter = mkUI (spec 0) \ctx -> do
4741
val <- readState ctx
48-
return $ p [ className "Counter"
49-
, onClick (incrementCounter ctx)
50-
]
51-
[ text (show val)
52-
, text " Click me to increment!"
53-
]
42+
return $ D.p [ P.className "Counter"
43+
, P.onClick (incrementCounter ctx)
44+
]
45+
[ D.text (show val)
46+
, D.text " Click me to increment!"
47+
]
5448
5549
main = do
56-
let component = div [] [ hello { name: "World" }
57-
, counter {}
58-
]
50+
let component = D.div [] [ counter {} ]
5951
renderToBody component
6052
```

Diff for: test/Main.purs

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ import qualified React.DOM.Props as P
1212

1313
foreign import interval :: forall eff a.
1414
Int ->
15-
Eff (console :: CONSOLE | eff) a ->
16-
Eff (console :: CONSOLE | eff) Unit
15+
Eff eff a ->
16+
Eff eff Unit
1717

1818
hello = mkUI (spec unit) \ctx -> do
1919
props <- getProps ctx

0 commit comments

Comments
 (0)