setTimeout solved it
useEffect(() => {
if (iframeRef.current) {
iframeRef.current.onload = () => {
setTimeout(() => {
iframeRef.current.contentWindow.postMessage(
{ data }
,process.env.IFRAME_LINK);
}, 100);
};
}
}, []);