Fork me on GitHub
#reagent
<
2018-11-01
>
romdoq08:11:16

Might be the wrong level of the stack to ask this, but when I create an :on-drop handler on an element in my hiccup, the actual javascript handler (react-dom) appears to be attached to the document object. Is there any way to get a handler attached directly to the element instead? The site I'm integrating with has a global drop-handler on the body element which overrides the react one.

romdoq08:11:07

fwiw, I'm working with re-frame, but afaict this is not something re-frame affects

lilactown16:11:46

yeah that's a React thing

lilactown16:11:14

you could use a ref to attach the event handler directly, but it's going to be a very manual process

lilactown16:11:39

you'll need to use a React class (since I'm not sure if reagent supports ref forwarding)

justinlee19:11:23

Isn’t a ref actually a handle to the vdom element? I think you’ll probably just want to attach an ID to the element and then grab the element using getElementById

lilactown19:11:23

nope it's a reference to the actual DOM element

justinlee19:11:07

that must be if it’s only a native element, because you can access instance methods on a ref if it is a component

justinlee19:11:12

maybe i’m missing something

lilactown19:11:36

ah, yes, that's correct