Storing NodeRef inside Context #2669
Unanswered
vitordhers
asked this question in
Q&A
Replies: 1 comment
-
This is unrelated to the question of storing it in context, per se, and seems to just be a syntactic quirk with the view macro not expecting a dotted field there. The codebox link seems wrong to my maybe, but I was able to reproduce the issue and solve it with a local variable. let my_ctx2 = NodeRefObj {
input_ref: NodeRef::new(),
};
let foo = my_ctx2.input_ref;
view! {
<input type="text"
node_ref=foo
/>
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Folks, is it possible to store
NodeRef
inside aContext
?In order to avoid using
web_sys
library'sdocument().get_element_by_id()
(as it is usually better practice storingref
s instead of directly manipulatingDOM
in frameworks), I wanted to store aNodeRef
inside aContext
, but that doesn't seem to be possible due to this error:this method takes 1 argument but 0 arguments were supplied
when trying this:Please check this codebox link in order to check what's happening.
I can confirm the same error applies to
leptos
v0.6.11.Is that a bug or am I missing anything really fundamental?
Thanks in advance
Beta Was this translation helpful? Give feedback.
All reactions