TypeScript React forwardRef

Create a component where you can pass a ref.

const MyComponent = React.forwardRef<HTMLDivElement, Props>(
  (props, ref) =>
    <div ref={ref} {...props} />
);
Last Updated February 27, 2021