@@ -22,6 +22,7 @@ module React
2222  , Render ()
2323
2424  , UISpec ()
25+   , UIFactory ()
2526
2627  , Event ()
2728  , MouseEvent ()
@@ -33,6 +34,7 @@ module React
3334
3435  , getProps 
3536  , getRefs 
37+   , getChildren 
3638
3739  , readState 
3840  , writeState 
@@ -45,6 +47,7 @@ module React
4547  , renderToString 
4648  , renderToBody 
4749  , renderToElementById 
50+   , createElement 
4851  ) where 
4952
5053import  Prelude 
@@ -202,6 +205,9 @@ type UISpec props state eff =
202205             ) Unit 
203206  } 
204207
208+ --  | Factory function for components.
209+ type  UIFactory  props  =  props  ->  UI 
210+ 
205211--  | Create a component specification.
206212spec  ::  forall  props  state  eff . state  ->  Render  props  state  eff  ->  UISpec  props  state  eff 
207213spec st render =
@@ -227,6 +233,11 @@ foreign import getRefs :: forall write eff.
227233                            UIRef  -> 
228234                            Eff  (refs  ::  ReactRefs  (Read  write ) | eff ) Refs 
229235
236+ --  | Read the component children property.
237+ foreign  import  getChildren  ::  forall  props  eff .
238+                                 UIRef  -> 
239+                                 Eff  (props  ::  ReactProps  props  | eff ) (Array  UI )
240+ 
230241--  | Write the component state.
231242foreign  import  writeState  ::  forall  state  eff .
232243                               UIRef  -> 
@@ -250,8 +261,7 @@ transformState ctx f = do
250261--  | Create a component from a component spec.
251262foreign  import  mkUI  ::  forall  props  state  eff .
252263                         UISpec  props  state  eff  -> 
253-                          props  -> 
254-                          UI 
264+                          UIFactory  props 
255265
256266--  | Create an event handler.
257267foreign  import  handle  ::  forall  eff  ev  props  state  result .
@@ -266,3 +276,6 @@ foreign import renderToBody :: forall eff. UI -> Eff (dom :: DOM | eff) UI
266276
267277--  | Render a component to the element with the specified ID.
268278foreign  import  renderToElementById  ::  forall  eff . String  ->  UI  ->  Eff  (dom  ::  DOM  | eff ) UI 
279+ 
280+ --  | Create an element from a component factory.
281+ foreign  import  createElement  ::  forall  props . UIFactory  props  ->  props  ->  Array  UI  ->  UI 
0 commit comments