-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathApp.purs
More file actions
37 lines (30 loc) · 875 Bytes
/
App.purs
File metadata and controls
37 lines (30 loc) · 875 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
module Components.App where
import Prelude
import Components.Toggle (toggle)
import Components.Counter (mkCounter)
import Components.ToggleHooks (mkToggle)
import Effect (Effect)
import React.Basic.Classic (Component, JSX, createComponent, makeStateless)
import React.Basic.DOM as R
component :: Component Unit
component = createComponent "App"
classicApp :: JSX
classicApp = unit # makeStateless component \_ ->
R.div_
[ R.h1_ [ R.text "Hello world" ]
, toggle { initialValue: true }
, toggle { initialValue: false }
]
mkApp :: Effect JSX
mkApp = do
counter <- mkCounter
toggleHooks <- mkToggle
pure $ unit # makeStateless component \_ ->
R.div_
[ R.h1_ [ R.text "Hello world" ]
, toggle { initialValue: true }
, toggle { initialValue: false }
, counter 0
, toggleHooks false
, toggleHooks true
]