typescript-book icon indicating copy to clipboard operation
typescript-book copied to clipboard

React.forwardRef example

Open basarat opened this issue 6 years ago • 0 comments

type RenderedViewProps = { url: string };
const RenderedView: React.FC<RenderedViewProps> = React.forwardRef<HTMLIFrameElement, RenderedViewProps>((props, ref) => {
  return <iframe ref={ref} src={props.url} style={{
    width: '100%',
    border: 'none',
    backgroundColor: 'white',
  }} />
});

basarat avatar Dec 02 '19 06:12 basarat