@@ -59,7 +59,10 @@ module Component where
5959
6060import Prelude
6161
62+ import Effect.Uncurried (mkEffectFn1)
63+
6264import React as React
65+ import React.SyntheticEvent as Event
6366
6467import Clock as Clock
6568
@@ -68,8 +71,8 @@ clock =
6871 React.createElement Clock.clockComponent
6972 { format: "HH:mm:ss"
7073 , className: "test-class-name"
71- , onTick: React.handle $ \event -> do
72- React .preventDefault event
74+ , onTick: mkEffectFn1 $ \event -> do
75+ Event .preventDefault event
7376 -- etc.
7477 pure unit
7578 } []
@@ -90,7 +93,10 @@ module Clock
9093
9194import Prelude
9295
93- import React (ReactClass, ReactElement, SyntheticEventHandlerContext, Children, createElement, handle)
96+ import Effect (Effect)
97+ import Effect.Uncurried (mkEffectFn1)
98+
99+ import React (ReactClass, ReactElement, Children, createElement)
94100import React.SyntheticEvent (SyntheticEvent)
95101import React.DOM.Props (Props, unsafeFromPropsArray, unsafeMkProps)
96102
@@ -100,8 +106,8 @@ clockComponent props children = createElement clockComponent_ (unsafeFromPropsAr
100106format :: String -> Props
101107format = unsafeMkProps "format"
102108
103- onTick :: forall eff props state. (SyntheticEvent -> SyntheticEventHandlerContext eff props state Unit) -> Props
104- onTick k = unsafeMkProps "onTick" (handle k)
109+ onTick :: (SyntheticEvent -> Effect Unit) -> Props
110+ onTick k = unsafeMkProps "onTick" (mkEffectFn1 k)
105111
106112foreign import clockComponent_
107113 :: ReactClass
@@ -117,6 +123,7 @@ module Component where
117123import Prelude
118124
119125import React as React
126+ import React.SyntheticEvent as Event
120127import React.DOM.Props as Props
121128
122129import Clock as Clock
@@ -126,7 +133,7 @@ clock =
126133 Clock.clockComponent
127134 [ Clock.format "HH:mm:ss"
128135 , Clock.onTick $ \event -> do
129- React .preventDefault event
136+ Event .preventDefault event
130137 -- etc.
131138 pure unit
132139 , Props.className "test-class-name"
@@ -200,7 +207,7 @@ var orderedList = function (dictOrd) {
200207 var component = function ($$this ) {
201208 // ...
202209 };
203- return React .component ()(" OrderedList" )(component);
210+ return React .component (React . reactComponentSpec ()() )(" OrderedList" )(component);
204211};
205212```
206213
0 commit comments