purescript-contrib/purescript-react

preventDefault?

teh opened this issue · 3 comments

teh commented

Right now I'm stopping events from propagating like this:

onSubmit ev = do
  (unsafeCoerce ev).preventDefault
  ...    

Would you be opposed to me introducing this function (and others from https://facebook.github.io/react/docs/events.html)?

Agree. I have a similar function. :(

On Friday, September 9, 2016, teh notifications@github.com wrote:

Right now I'm stopping events from propagating like this:

onSubmit ev = do
(unsafeCoerce ev).preventDefault
...

Would you be opposed to me introducing this function (and others from
https://facebook.github.io/react/docs/events.html)?


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#83, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AIE1EKWWPa-LSJMmBDBoeZlWy6wE35Inks5qoeQogaJpZM4J5jGE
.

ethul commented

I do think preventDefault and friends are useful functions to have. Do you think there is any way to leverage preventDefault from purescript-dom?

ethul commented

However, since the react library defines its own Event type, perhaps defining preventDefault separately here does make more sense.