-
When this library is complete, what is the intention for use with React? For example, I don't see bindings for converting from reactevent to Dom event. Is that intentional? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
currently, we have to use an let onScroll = event => {
open Webapi.Dom
// TODO: https://github.com/tinymce/rescript-webapi/discussions/43
let element = event->ReactEvent.UI.currentTarget->Obj.magic
let scrollHeight = element->Element.scrollHeight
let clientHeight = element->Element.clientHeight
let scrollOffset = scrollHeight - clientHeight * 2
if element->Element.scrollTop > scrollOffset->Int.toFloat {
// ... some logic
}
} |
Beta Was this translation helpful? Give feedback.
-
This is more for pure dom bindings similar to how typescript has built in dom bindings. Any library specific things like converting to/from react types could be added to a library that depends on this instead. Like a |
Beta Was this translation helpful? Give feedback.
-
The ReScript team has been very clear that they would prefer everyone not use bindings, or make their own, for everything DOM. The return type of So no, unfortunately it will never be possible for this library to play nicely with |
Beta Was this translation helpful? Give feedback.
The ReScript team has been very clear that they would prefer everyone not use bindings, or make their own, for everything DOM. The return type of
currentTarget
, and many other methods, is an open object:https://github.com/rescript-lang/rescript-react/blob/c3017ec4bbce5847c3b2da8d2d536450a3e2fd6d/src/ReactEvent.resi#L46-L47
So no, unfortunately it will never be possible for this library to play nicely with
rescript-react
.