Created
July 28, 2023 08:13
-
-
Save turbod/a6a2e1cacf859e6971d8a8315b1312b2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { OtherComponent } from "./other-component"; | |
import React, { useRef, ElementRef } from "react"; | |
// Pass it in via typeof! | |
type OtherComponentRef = ElementRef<typeof OtherComponent>; | |
const Component = () => { | |
const ref = useRef<OtherComponentRef>(null); | |
return <OtherComponent ref={ref}>Hello</OtherComponent>; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment