Access child ref from parent component

Hello ya'll. I am having a bit of a brain fart, id like to access the child ref of an element from the parent. What is the best way to do this, ive done this before, but am having a brain fart atm.
6 Replies
DaOfficialWizardšŸ§™
Note - i solved it by using Props and mergeRef from solid primatives
mdynnl
mdynnlā€¢12mo ago
here's the gist of it
const Child = (props) => {
let div;
return <div ref={ref => { div = ref; props.ref(ref) }} />
}
const Parent = () => {
let child;
return <Child ref={child} />
}
const Child = (props) => {
let div;
return <div ref={ref => { div = ref; props.ref(ref) }} />
}
const Parent = () => {
let child;
return <Child ref={child} />
}
DaOfficialWizardšŸ§™
Yeah, that makes a lot of sense šŸ™‚
mdynnl
mdynnlā€¢12mo ago
if you wanna dive a little, try searching signal ref here in discord as i'll be just repeating the same thing over and over again lol
DaOfficialWizardšŸ§™
i tried searching before i asked, but couldnt find anything using my search terms. Thanks for this!
mdynnl
mdynnlā€¢12mo ago
nah, this is only if you want to dive in šŸ˜‰