How to use Iframe in reactjs




We will use npm package:  https://www.npmjs.com/package/react-iframe

to use iframe in reactjs. this is Simple React component for including an iframed page.

First of all just simply run command to install the package in your project:
npm i react-iframe


 Now import react-iframe in your js file:

import Iframe from 'react-iframe'
Then add Iframe with youtube video link:
<Iframe url="http://www.youtube.com/embed/xDMP3i36naA"
        width="450px"
        height="450px"
        id="myId"
        className="myClassname"
        display="initial"
        position="relative"/>


Basic Properties

url (required) - string the iframe url.

src (optional) - string if set, overrides url.

scrolling (optional) - string not set if if not provided .

overflow (optional)- string default to "hidden".

Thank You