forked from purescript-react/purescript-react-basic
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.purs
More file actions
22 lines (19 loc) · 649 Bytes
/
Main.purs
File metadata and controls
22 lines (19 loc) · 649 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
module Main where
import Prelude
import AsyncCounter (asyncCounter)
import Data.Maybe (Maybe(..))
import Effect (Effect)
import Effect.Exception (throw)
import React.Basic.DOM (render)
import Web.DOM.NonElementParentNode (getElementById)
import Web.HTML (window)
import Web.HTML.HTMLDocument (toNonElementParentNode)
import Web.HTML.Window (document)
main :: Effect Unit
main = do
container <- getElementById "container" =<< (map toNonElementParentNode $ document =<< window)
case container of
Nothing -> throw "Container element not found."
Just c ->
let app = asyncCounter { label: "Async Increment" }
in render app c