You need to be clearer about your requirements. Are you saying you want to resize the iframe to the size of the canvas being loaded into it? That might be relatively tricky and involve communication between iframe content and host page.
If you just want to make contents of iframe adapt to iframe size then you essentially have the same requirements as someone wanting to make a responsive canvas.
Answers
Plz provide some code. Otherwise the onky answer I can suggest is css.
Kf
I'm trying to dynamically render the iframe from alpha p5 text editor in react
render() { return(<iframe src = {src obtained from p5 text editor}></iframe>) }
I need to adjust the size according to the size of the canvas inside. Thank you
You need to be clearer about your requirements. Are you saying you want to resize the iframe to the size of the canvas being loaded into it? That might be relatively tricky and involve communication between iframe content and host page.
If you just want to make contents of iframe adapt to iframe size then you essentially have the same requirements as someone wanting to make a responsive canvas.
I remembered there's a JS library that resizes iframes to their contents: https://github.com/davidjbradshaw/iframe-resizer
I'm sorry for not being clear. You are right, I want to resize the iframe according to the content inside, i.e the canvas.