import useSWR from 'swr' import { getUrl2 } from '../lib/tmdb' import { fetcher, renderResults, sliceArray } from '../utils' import CardNormal from './CardNormal' import Heading from './Heading' import Loading from './Loading' export default function Collection({ Component = CardNormal, endpoint, href, isHomePage, isTrending, limit = 8, media_type = 'movie', title, type = 'movie' }) { const { data, error } = useSWR(endpoint, fetcher) if (error) return
Error occurred
return ( <> {data ? (
{renderResults( sliceArray(data.results || [], limit), Component, media_type )}
) : ( )} ) }