I have a parent component in which I use a component imported from a library. The component library from which I imported the child component uses another package. I'm trying to call a function present in that component. I have tried using ref but I found that its not being passed down. Is there any way i can do this? Its sort of like this.
const ParenComponent = () => {
return (
<>
{/* imported from library */}
<ChildComponent />
</>
);
};
const ChildComponent = () => {
// no ref passed down to grandchild component
return (
<>
<GrandChild />
</>
);
};
const GrandChild = () => {
const ref = useRef(null);
const logSomething = () => {
ref.current.someFunction();
};
return (
<>
<div />
</>
);
};