Hey Yoav, really nice example. Can we use useImperativeHandle to share refs between siblings?
For example, I want to target a ref in one sibling component & access it from other sibling, here's a full description of what I mean β stackoverflow.com/questions/654763...
I writeβ code and prose.
https://github.com/rpldy/react-uploady - Modern file uploading components & hooks for React. https://whitecloudsbook.com - My first sci-fi novel.
The simple answer is yes. You can use it just like any other ref.
Architecturally, I'm not sure that's the best approach. As you (or someone else) may end up changing the "API" of the obj you assign the ref in one side without realizing its effect on its sibling.
In general, I don't think you want to build dependencies between sibling components this way.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hey Yoav, really nice example. Can we use
useImperativeHandle
to share refs between siblings?For example, I want to target a
ref
in one sibling component & access it from other sibling, here's a full description of what I mean β stackoverflow.com/questions/654763...The simple answer is yes. You can use it just like any other ref.
Architecturally, I'm not sure that's the best approach. As you (or someone else) may end up changing the "API" of the obj you assign the ref in one side without realizing its effect on its sibling.
In general, I don't think you want to build dependencies between sibling components this way.