File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
staging/thermite/src/Thermite Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change
1
+ module Thermite.Try where
2
+
3
+ import Prelude
4
+
5
+ import Control.Monad.Eff (Eff )
6
+ import Data.Maybe (fromJust )
7
+ import Data.Newtype (wrap )
8
+ import DOM (DOM ) as DOM
9
+ import DOM.HTML (window ) as DOM
10
+ import DOM.HTML.Types (htmlDocumentToParentNode ) as DOM
11
+ import DOM.HTML.Window (document ) as DOM
12
+ import DOM.Node.ParentNode (querySelector ) as DOM
13
+ import Partial.Unsafe (unsafePartial )
14
+ import React (createFactory ) as R
15
+ import ReactDOM (render ) as R
16
+ import Thermite as T
17
+
18
+ -- | The main method creates the task list component, and renders it to the document body.
19
+ defaultMain :: forall state action eff . T.Spec eff state Unit action -> state -> Eff (dom :: DOM.DOM | eff ) Unit
20
+ defaultMain spec initialState = void do
21
+ let component = T .createClass spec initialState
22
+ document <- DOM .window >>= DOM .document
23
+ container <- unsafePartial fromJust <$> DOM .querySelector (wrap " #app" ) (DOM .htmlDocumentToParentNode document)
24
+ R .render (R .createFactory component unit) container
You can’t perform that action at this time.
0 commit comments