"use client" import React from "react"; import useSWR, { SWRConfig } from 'swr' import { useEffect, useState } from 'react'; import { ProdukCard } from "@/app/library/card"; import { LoaderJo } from "@/app/component/loader"; const fetcher = (...args) => fetch(...args).then((res) => res.json()) const DaftarPremium = () =>{ const [count, setCount] = useState(0); const { data: dPremium, mutate } = useSWR(`/pages/api/produk?order=uniqid&ascdesc=DESC&limit=24&start=${count}&approval=1®=1`, fetcher) return <> {!dPremium ? <> > : {dPremium ? dPremium.message.map((x, i) => { x.key = i; return ( ) }):<>>} { if(count != 0){ setCount(count-24); mutate(); window.scrollTo(0, 0) } }} >Listing Sebelumnya { let cn = dPremium ? dPremium.message.length:0; setCount(count+24); mutate(); window.scrollTo(0, 0) }} >Listing Selanjutnya } > } export default DaftarPremium;