Iframes and React.js - How to embed a youtube video into my app
You can just use an iframe
element to achieve this. There is no need to depend on yet another npm
package.
<iframe src='https://www.youtube.com/embed/E7wJTI-1dvQ'
frameborder='0'
allow='autoplay; encrypted-media'
allowfullscreen
title='video'
/>
By the way, if you are wondering why the embed URL
looks like it looks, you can just go to an arbitrary Youtube video
, click on Share
and then you immediately see that we just need to append /embed/:videoId
Youtube's
base URL
.
You can use react component react-youtube