RIO Iframe resizer
npm install @rio-cloud/iframe-resizer

javascript
function onResize() {
if (document.referrer) {
const height = document.body.clientHeight;
window.parent.postMessage({ height: height }, document.referrer);
}
}
`
The IframeResizer will listen for these messages and behave accordingly.
If your SPA is also written in React, you would probably implement this in a `componentDidUpdate()` function.Usage
1. In your parent, where you want to display the Iframe : Update your package.json and add the Iframe-Resizer to the dependencies:
`
"@rio-cloud/iframe-resizer": "0.0.1"
` 2. Execute npm install
3. Add the in your parentApplication.js with the URL of the SPA you want to display in it and add it to the rendering.
`javascript
import IframeResizer from '@rio-cloud/iframe-resizer';const myGreatApp =
`
Local development and testing
To start the demo app locally, first run `npm run start-demo` then run `npm run start`` in a separate terminal.