I am making an ecommerce platform project but I need some help. on my main page I have the products, I used .map to iterate through all of them to render them all. I want it to be where if you click on a button on a product it will take you to that products page with more details. My only problem is I don't know how to render one product and not multiple. here is the code I am trying to work on
import React from 'react';
import { Card, CardMedia, CardContent, CardActions, Typography, IconButton, Button } from '@material-ui/core';
import useStyles from './styles';
const ProductPage = ({ products, onAddToCart }) => {
const classes = useStyles();
{products.map((product) => (
console.log(product)
))}
return (
<Card className={classes.root}>
</Card>
);
};
export default ProductPage;
basically it just maps through all of the products and console logs all of the products. But I only want it to console.log the product that I clicked on. How do I do that?