Skip to content

Instantly share code, notes, and snippets.

View kirthegrave's full-sized avatar
🦀
Working from home

Kir kirthegrave

🦀
Working from home
View GitHub Profile
@kirthegrave
kirthegrave / foo.tsx
Created July 16, 2021 07:35 — forked from OliverJAsh/foo.tsx
TypeScript React HOC using `forwardRef`
import * as React from 'react';
import { Component, ComponentClass, createRef, forwardRef, Ref } from 'react';
const myHoc = <ComposedComponentProps extends {}>(
ComposedComponent: ComponentClass<ComposedComponentProps>,
) => {
type ComposedComponentInstance = InstanceType<typeof ComposedComponent>;
type WrapperComponentProps = ComposedComponentProps & {
wrapperComponentProp: number;