"use client"; import { allProduct } from "@/lib/allProducts"; import { useEffect, useState } from "react"; import EmptyState from "./emptyData"; export default function Products() { const [allProducts, setAllProducts] = useState(null); useEffect(() => { const all = allProduct(); all && Array.isArray(all) && all.length > 0 ? setAllProducts(all) : setAllProducts([]); setAllProducts; }, []); return (
{allProducts && allProducts.length > 0 ? (
) : ( )}
); }