You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using refs to register event listeners for non-Yew-supported event types. Following the node_refs example, it makes sense to use the rendered method to do setup on first render. But what happens when the value of the ref changes? E.g. if the Node being refd is rendered conditionally? In React, this is where I would reach for a "callback ref" passed a class method or a function with a bound this. Maybe the Yew analog would be a Callback to dispatch a message upon ref assignment?
What I've tried
I can store the result of ref.get() in the component struct and do an equality check in rendered, but this strikes me as roundabout and not incredibly ergonomic. It's possible that not many people have (or have expressed) this use case, and thus it's not even on yew's radar. That's perfectly alright. I'm just wondering if there's already a "blessed" strategy for this that I'm simply overlooking.
The text was updated successfully, but these errors were encountered:
Question
I'm using refs to register event listeners for non-Yew-supported event types. Following the
node_refs
example, it makes sense to use therendered
method to do setup on first render. But what happens when the value of the ref changes? E.g. if theNode
beingref
d is rendered conditionally? In React, this is where I would reach for a "callback ref" passed a class method or a function with a boundthis
. Maybe the Yew analog would be aCallback
to dispatch a message upon ref assignment?What I've tried
I can store the result of
ref.get()
in the component struct and do an equality check inrendered
, but this strikes me as roundabout and not incredibly ergonomic. It's possible that not many people have (or have expressed) this use case, and thus it's not even onyew
's radar. That's perfectly alright. I'm just wondering if there's already a "blessed" strategy for this that I'm simply overlooking.The text was updated successfully, but these errors were encountered: