Skip to content

Commit 756c021

Browse files
committed
Update README
1 parent dac7f46 commit 756c021

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

README.md

+14-7
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,10 @@ module Component where
5959
6060
import Prelude
6161
62+
import Effect.Uncurried (mkEffectFn1)
63+
6264
import React as React
65+
import React.SyntheticEvent as Event
6366
6467
import 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
9194
import 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)
94100
import React.SyntheticEvent (SyntheticEvent)
95101
import React.DOM.Props (Props, unsafeFromPropsArray, unsafeMkProps)
96102
@@ -100,8 +106,8 @@ clockComponent props children = createElement clockComponent_ (unsafeFromPropsAr
100106
format :: String -> Props
101107
format = 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
106112
foreign import clockComponent_
107113
:: ReactClass
@@ -117,6 +123,7 @@ module Component where
117123
import Prelude
118124
119125
import React as React
126+
import React.SyntheticEvent as Event
120127
import React.DOM.Props as Props
121128
122129
import 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

Comments
 (0)