We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
import { useState, useEffect } from "react"; import { Link, useParams } from "react-router-dom"; import ReactPlayer from "react-player"; import { Box, Typography, Stack } from "@mui/material"; import { CheckCircle } from "@mui/icons-material";
import { Videos } from "./"; import { fetchFromAPI } from "../utils/FetchFromAPI";
const VideoDetail = () => { const [videoDetail, setVideoDetail] = useState(null); console.log(videoDetail);
const { id } = useParams;
useEffect(() => { fetchFromAPI(videos?part=snippet,statistics&id=${id}).then((data) => setVideoDetail(data.items[0]) ); }, [id]);
videos?part=snippet,statistics&id=${id}
// if (!videoDetail?.snippet) return "Loading...";
// const { // snippet: { title }, // } = videoDetail; return ( <Stack direction={{ xs: "column", md: "row" }}> <Box sx={{ width: "100%", position: "sticky", top: "86px" }}> <ReactPlayer url={https://www.youtube.com/watch?v=${id}} className="react-player" controls /> {videoDetail.snippet.title} ); };
https://www.youtube.com/watch?v=${id}
export default VideoDetail;
The text was updated successfully, but these errors were encountered:
No branches or pull requests
import { useState, useEffect } from "react";
import { Link, useParams } from "react-router-dom";
import ReactPlayer from "react-player";
import { Box, Typography, Stack } from "@mui/material";
import { CheckCircle } from "@mui/icons-material";
import { Videos } from "./";
import { fetchFromAPI } from "../utils/FetchFromAPI";
const VideoDetail = () => {
const [videoDetail, setVideoDetail] = useState(null);
console.log(videoDetail);
const { id } = useParams;
useEffect(() => {
fetchFromAPI(
videos?part=snippet,statistics&id=${id}
).then((data) =>setVideoDetail(data.items[0])
);
}, [id]);
// if (!videoDetail?.snippet) return "Loading...";
// const {
// snippet: { title },
// } = videoDetail;
return (
<Stack direction={{ xs: "column", md: "row" }}>
<Box sx={{ width: "100%", position: "sticky", top: "86px" }}>
<ReactPlayer
url={
https://www.youtube.com/watch?v=${id}
}className="react-player"
controls
/>
{videoDetail.snippet.title}
);
};
export default VideoDetail;
The text was updated successfully, but these errors were encountered: