Skip to content

Instantly share code, notes, and snippets.

@ChaseH88
Created December 17, 2021 16:58
Show Gist options
  • Save ChaseH88/2a669b82bde8d7208769169b956a94e9 to your computer and use it in GitHub Desktop.
Save ChaseH88/2a669b82bde8d7208769169b956a94e9 to your computer and use it in GitHub Desktop.
useRef - TypeScript Example
// Main Component
let myRef = useRef<HTMLDivElement>(null);
// Child Component
interface MYINTERFACE {
// ...props
}
const Notifications = React.forwardRef<HTMLDivElement, MYINTERFACE>(({ MYPROPS }, ref) => {
return <div>My Component</div>
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment