import { Button, Container, Grid } from '@mui/material';
import { Box } from '@mui/system';
import Image from 'next/image';
import ProductCard from '../product-card/ProductCard';
const ProductsGrid = ({ allProducts, hasNextPage, fetchNextPage }) => {
// const allItems = useMemo(
// () => allProducts?.pages?.flatMap((page) => page.product),
// [allProducts]
// );
const dataToDisplay = allProducts.pages.map((page) =>
page.product.map((item) => (
))
);
// const dataToDisplay = allProducts.map((item) => (
//
//
//
// ));
return (
{dataToDisplay}
{hasNextPage && (
}
sx={{
backgroundColor: 'primary.main',
height: 50,
width: 150,
color: 'white',
':hover': {
bgcolor: 'primary.main', // theme.palette.primary.main
color: 'white',
},
}}
>
Load More
)}
);
};
export default ProductsGrid;