doc: import BrowserRouter, Routes, and Route from react-router-dom, and import...

This commit is contained in:
Leon Xu committed 2022-08-28 03:16:51 +00:00
1 parent 96a9bbdbb5
commit 065dd50d83
24 files changed
+576 -7

No files matched your search

+25
View File
@@ -0,0 +1,25 @@
import { useState, useEffect } from 'react';
import { Box, Typography } from "@mui/material";
import { useParams } from "react-router-dom";
import { api } from "../utils/api";
import { Videos } from './'
const SearchFeed = () => {
const [videos, setVideos] = useState ([])
const { searchTerm } = useParams();
useEffect (() => {
api (`search?part=snippet&q=${searchTerm}`)
.then ((data) => setVideos (data.items))
}, [searchTerm]);
return (
<Box p={2} sx={{overflowY: 'auto', height: '90vh', flex: '2'}}>
<Typography variant={"h4"} fontWeight={"bold"} mb={2} sx={{color: "white"}}>
Search Request for: <span style={{color: "#F31503"}}>
{searchTerm}</span> videos
</Typography>
<Videos videos={videos}/>
</Box>
)
}
export default SearchFeed;