git.iko.soy/rowtype-yoga/ry-starter-spa
on main help sign in
Integrate Counter component
1d8a2abMark Eibes
src/Main.purs+6−7
@@ -1,22 +1,20 @@
1module Main where
1module Main where
2
2
3−import Prelude
3+import Prelude.Default
4
4
5−import Data.Maybe (Maybe(..))
5+import Components.Example as Example
6−import Effect (Effect)
7import Effect.Exception (throw)
6import Effect.Exception (throw)
8import React.Basic (JSX)
7import React.Basic (JSX)
9import React.Basic.DOM (render)
8import React.Basic.DOM (render)
10−import React.Basic.DOM as R
11import Web.DOM (Element)
9import Web.DOM (Element)
12import Web.DOM.NonElementParentNode (getElementById)
10import Web.DOM.NonElementParentNode (getElementById)
13import Web.HTML (window)
11import Web.HTML (window)
14import Web.HTML.HTMLDocument (toNonElementParentNode)
12import Web.HTML.HTMLDocument (toNonElementParentNode)
15import Web.HTML.Window (document)
13import Web.HTML.Window (document)
16
14
17−-- | The main JSX/React Component for this single-page-application.
15+-- | Constructs the main React Component for this single-page-application.
18−app :: JSX
16+mkApp :: Effect JSX
19−app = R.text "Hello, PureScript!"
17+mkApp = Example.component <#> (_ $ 0)
20
18
21-- | The id of the HTML element which will wrap the React App.
19-- | The id of the HTML element which will wrap the React App.
22-- | It needs to match your `index.html` file, for example:
20-- | It needs to match your `index.html` file, for example:
@@ -31,6 +29,7 @@ containerId = "container"
31main :: Effect Unit
29main :: Effect Unit
32main = do
30main = do
33 container <- getContainerById containerId
31 container <- getContainerById containerId
32+ app <- mkApp
34 render app container
33 render app container
35
34
36-- | Finds an Element based on its ID in
35-- | Finds an Element based on its ID in