**I was making an Amazon clone and the add to cart button is not working.** I was rending this is home component and getting all these props from there only. Somebody, please help. I was stuck there for 2 days only.
Any help is appreciated.
???

```
import React from 'react';
import "./Product.css";
import {useStateValue} from './StateProvider';

function Product({id, title, price, rating, image}) {

    const [state, dispatch] = useStateValue();

    function addToCart(event) {

        console.log(event);

        dispatch({
            type: 'ADD_TO_CART',
            item: {

                id: id,

                title: title,
                image: image,
                price: price,
                rating: rating
            },
        });

    };

    return (
        <div className="product">

            <div className='product__info'>
                <p>{title}</p>
                <p className='product__price'>
                    <small>₹</small>
                    <strong>{price}</strong>

                </p>
                <div className='product__rating'>
                    {
                        Array(rating)
                            .fill()
                            .map((_, i) => (<p>⭐</p>))
                    }
                </div>
            </div>
            <img src={image} alt=''/>
            <button onClick={addToCart}>Add to cart</button>

        </div>
    );
}

export default Product

```