Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

how to add youtube videos to react app

import React from "react";
import YouTube from "react-youtube"; // run npm i react-youtube
  
export default class YoutubeVideo 
extends React.Component {
  render() {
    const opts = {
      height: "390",
      width: "640",
      playerVars: {
        autoplay: 1,
      },
    };
  
    return (
      <div>
        <h3>GeeksforGeeks - Youtube</h3>
        <YouTube videoId="sTnm5jvjgjM" 
            opts={opts} onReady={this._onReady} />
      </div>
    );
  }
  
  _onReady(event) {
    event.target.pauseVideo();
  }
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: how to check if checkbox is checked in jquery 
Javascript :: javascript calculator 
Javascript :: Google Maps JavaScript API error: InvalidKeyMapError 
Javascript :: increased the value of a counter when a button is clicked in javascript 
Javascript :: json.stringify vs json.parse 
Javascript :: fetch Response object get content type 
Javascript :: react script 
Javascript :: jquery 1 cdn 
Javascript :: function call ready resize and load 
Javascript :: how remove the spaces from the string, then return the resultant string 
Javascript :: copy link to clipboard 
Javascript :: classiceditor is not defined using npm 
Javascript :: js object loop 
Javascript :: Uncaught (in promise) SyntaxError: Unexpected token O in JSON at position 0 
Javascript :: preload 
Javascript :: scroll to top router link vue 
Javascript :: js if dark mode 
Javascript :: react native modal close when click outside 
Javascript :: javascript json stringify indented 
Javascript :: bootstap jquery 
Javascript :: Lazy Loading Routes vue 
Javascript :: localstorage try catch 
Javascript :: npm run js file from command line 
Javascript :: body-parser deprecated 
Javascript :: anagram javascript example 
Javascript :: calculate average javascript 
Javascript :: javascript datetime format 
Javascript :: how to convert number to character in javascript 
Javascript :: how to make dynamic title for screen in react native 
Javascript :: convert Float64Array to array in js 
ADD CONTENT
Topic
Content
Source link
Name
4+5 =