src/components/SearchPage/SearchPage.js
/*****Function*****
     * parameters: videos - list of all videos return from search results.
     * Info: format data to display result list.
    */
Function
parameters: videos - list of all videos return from search results.
Info: format data to display result list.
Function parameters : videos - list of all videos return from search results . Info : format data to display result list .
async function createVideoRows(videos) {
      let newVideoRows = [];
      for (const video of videos) {
        const videoId = video.id.videoId;
        const snippet = video.snippet;
        const title = snippet.title;
        const timestamp = DateTime.fromISO(snippet.publishedAt).toRelative();
        const channel = snippet.channelTitle;
        const description = snippet.description;
        const image = snippet.thumbnails.medium.url;
        newVideoRows.push({
          videoId,
          title,
          image,
          timestamp,
          channel, 
          description
        });
      };
      setVideoRows(newVideoRows);
      setIsLoading(false);
    }
async function createVideoRows ( videos ) { let newVideoRows = [ ] ; for ( const video of videos ) { const videoId = video . id . videoId ; const snippet = video . snippet ; const title = snippet . title ; const timestamp = DateTime . fromISO ( snippet . publishedAt ) . toRelative ( ) ; const channel = snippet . channelTitle ; const description = snippet . description ; const image = snippet . thumbnails . medium . url ; newVideoRows . push ( { videoId , title , image , timestamp , channel , description } ) ; } ; setVideoRows ( newVideoRows ) ; setIsLoading ( false ) ; }
Function
 parameters: videos - list of all videos return from search results.
Function parameters : videos - list of all videos return from search results .