Update component state when clicking button inside iframe?

Viewed 25

Is it possible to update state, based on the click of a button located inside an iframe?

I have a component which looks a little something like the below.

Within the iframe, there is a button for the user to click. I'd like to be able to set the state to true once the button is clicked. Is it possible to do that?

import ReactIframeResizer from 'react-iframe-resizer-super';

const Component = () => {
  const [state, setState] = useState(false);
  
  return (
    <ReactIframeResizer
      src={url}
    />
  )
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.6.3/umd/react.production.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.6.3/umd/react-dom.production.min.js"></script>

0 Answers
Related