Skip to content

Instantly share code, notes, and snippets.

@hoffmanilya
hoffmanilya / you_tube_video.js
Created September 9, 2021 15:11
YouTube façade as a React component with Tailwind styling
import React, { useState } from "react"
import { Helmet } from "react-helmet"
// Lazy loads a YouTube video by showing the thumbnail
// as a facade.
//
// Inspired by: @justinribeiro/lite-youtube
//
const YouTubeVideo = ({ videoId, title }) => {
const [connectionsLoaded, setConnectionsLoaded] = useState(false)