How to get references to elements #383
Replies: 1 comment
-
We haven't implemented domrefs yet since we need to support so many targets - not just wasm. For wasm, I've been suggesting using use_effect/use_future to get an element by its ID. I wish we had an example but none of our primary examples are set to build on wasm yet. use_future(&cx, || async move {
let el = getElementById("some id");
}); |
Beta Was this translation helpful? Give feedback.
-
I wish to call functions on the elements that have been layed out by dioxus, but doing so requires I obtain a
HTMLSomethingElement
type fromweb_sys
. In react this would be done with refs (https://reactjs.org/docs/refs-and-the-dom.html). Is there any way to achieve this functionality with dioxus?Another side question, is it possible to write event handlers that execute javascript or have access to the target's dom element?
Beta Was this translation helpful? Give feedback.
All reactions