How to send viewport to parent every time app is resized?

Hello, i found a way to get the height every time app is resized.

i used customComponent, i'm not sure if the best way but it's working for me

i added a useEffect to check the viewport, i set viewport global variable in the model state to receive it in the component, the code is something like that:

 React.useEffect(() => {
      console.log({viewport:model.viewport})
      window.top.postMessage({
        type: 'resize',
        viewport: model.viewport
      }, '*')
    }, [model.viewport])
2 Likes