import React, { useEffect } from "react"; import { useParams } from "react-router-dom"; import VideoCard from "../components/VideoCard"; import { getCategoryVideos } from "../redux/categorySlice"; import { useDispatch, useSelector } from "react-redux"; import timeSince from "../utils/date"; import "./feed.css"; function Feed() { const { id } = useParams(); const dispatch = useDispatch(); const { categoryVideos } = useSelector((state) => state.category); const { sidebarExtend } = useSelector((state) => state.category); const { darkMode } = useSelector((state) => state.darkMode); useEffect(() => { dispatch( getCategoryVideos( `search?part=snippet&q=${id ? id : "Coding development"}` ) ); document.title = `${id ? id + "- Youtube" : "Home - Youtube"}`; }, [id]); useEffect(() => { document.body.style.backgroundColor = darkMode ? "#131417" : "#fff"; }, [darkMode]); var aDay = 24 * 60 * 60 * 1000; return ( <> {/* */}
{categoryVideos?.map((e, index) => { return (
); })}
); } export default Feed;