import { useEffect, useState } from "react"; import { Box, Typography, Button } from "@mui/material"; import ProductService from "../../services/ProductService"; import Grid from '@mui/material/Grid2'; const CollectionList = ({ productType }) => { const [collections, setCollections] = useState([]) useEffect(() => { ProductService.getCollections(productType).then((data) => { setCollections(data) }) }, []) return ( { collections.length > 0 && COLLECTIONS} {collections.map(({id, name, src}) => { return ( {name} ) })} ); }; export default CollectionList;