react-use-iframe-content-height
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

react-use-iframe-content-height

A React hook to poll an iframe for it's content height. It will only work if the parent and the source of the iframe are on the same domain.

Usage:

function MyIframe() {
  const [iframeRef, iframeHeight] = useIframeContentHeight();
 
  return (
    <iframe ref={iframeRef} height={iframeHeight} width="100%" src="/content" />
  );
}

Readme

Keywords

none

Package Sidebar

Install

npm i react-use-iframe-content-height

Weekly Downloads

185

Version

1.0.2

License

MIT

Unpacked Size

9.28 kB

Total Files

10

Last publish

Collaborators

  • kimfiedler