Render your React app to an iFrame
Adds new useFrame
hook for access to iframes window
and document
host objects without the need for the context render prop pattern.
import { useFrame } from 'react-frame-component';
function Foo (props) {
const { window, document } = useFrame();
/* rest of the component */
}
https://github.com/ryanseddon/react-frame-component/compare/v5.0.1...v5.1.0
Adds index.ts file to declare module for Typescript
https://github.com/ryanseddon/react-frame-component/compare/v5.0.0...v5.0.1
This library now uses srcDoc
which means no support for IE11 in v5 if you need IE11 support you can continue to use v4.1.3.
srcDoc is also async vs doc.write being sync, this will mostly go unnoticed in most use cases. However if you're relying on this library in unit tests you may need to convert those test to async aware tests. This means you'll need to use the done
callback in most unit test frameworks.
document.write is now bad practice for performance reasons and will be flagged accordingly in various web perf testing tools, srcDoc is a viable alternative without the perf downsides.
https://github.com/ryanseddon/react-frame-component/compare/v4.1.3...v5.0.0
This pre-release is testing whether srcdoc
usage over doc.write()
is a better move going forward. It's a breaking change as srcdoc
is async.
By changing to srcdoc
this will drop support for IE11.