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
Uh oh!
There was an error while loading. Please reload this page.
-
Folks, is it possible to store
NodeRefinside aContext?In order to avoid using
web_syslibrary'sdocument().get_element_by_id()(as it is usually better practice storingrefs instead of directly manipulatingDOMin frameworks), I wanted to store aNodeRefinside aContext, but that doesn't seem to be possible due to this error:this method takes 1 argument but 0 arguments were suppliedwhen trying this:Please check this codebox link in order to check what's happening.
I can confirm the same error applies to
leptosv0.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