Trying to get multiple product cards to appear in a slot I created called justAdded
on my homepage. I am getting my data correctly, it just isn’t creating the 4 product cards that it should. Here is my code:
export const getServerSideProps: GetServerSideProps = async (context) => {
const products = await prisma.product.findMany({
take: 4,
select: {
title: true,
media: true
}
})
return {
props: {
products: products
},
}
}
function Homepage({ products }: any, props: DefaultHomepageProps) {
return (
<PlasmicHomepage
{...props}
justAdded={
products.map((product: any) => {
// console.log(product.title);
<ProductCard
key={product.title}
title={product.title}
img={{
src: product.media[0].src,
fullWidth: 1920,
fullHeight: 1080,
aspectRatio: undefined,
}}
/>
})
}
/>
)
}