Halogen provides a handy RefLabel
, that allows to refer an element from elsewhere.
So for example, you can make a modal window component, and then use its ref
in another component to call showModal
or close
on it.
Upstream React provides useRef
hook that does the same.
However, I can’t seem to find anything in “react-basic-hooks”. Can I do something similar with it?
FWIW, every react-hooks JSX (an element) has special value in its record ref :: Ref (Nullable Node)
. But this alone doesn’t do much. For this to work there presumably should be some JSX -> Node
function, but such does not exist. I also tried cloning both react-hooks
and its dep react-basic
and did a git grep --color=always -P "\bNode\b" | grep -v "ref :: Ref"
, but got nothing relevant.
So it’s an open question, which if no one knows I presume might be best to ask the devs on the Github, because clearly they started working on the facility, but… Idk, it’s either they never finished it, or they did, but it is something very hidden and undocumented.