Skip to content

Commit 2f0b68e

Browse files
committed
Improve unsafeEventFn warning/explantion
1 parent c6ae2e2 commit 2f0b68e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/React/Basic/Events.purs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,11 @@ foreign import data SyntheticEvent :: Type
3737
-- | ```
3838
newtype EventFn a b = EventFn (a -> b)
3939

40-
-- | Unsafely create an `EventFn`. This function should be avoided.
41-
-- | Use the helper functions specific to your platform (such as `React.Basic.DOM.Events`).
40+
-- | Unsafely create an `EventFn`. This function should be avoided as it can allow
41+
-- | a `SyntheticEvent` to escape its scope. Accessing a React event's properties is only
42+
-- | valid in a synchronous event callback.
43+
-- |
44+
-- | Instead, use the helper functions specific to your platform, such as `React.Basic.DOM.Events`.
4245
unsafeEventFn :: forall a b. (a -> b) -> EventFn a b
4346
unsafeEventFn = EventFn
4447

0 commit comments

Comments
 (0)