I made an app with React which is displaying 9 cts on the screen. I made a button to add them to a cart and I want to make the app functionally just for demo purpose. I used hooks and I don't know what I did wrong.Here are the errors that I'm receiving:
Uncaught TypeError: Cannot read properties of undefined (reading 'map')
at Products (Products.js:8:1)
react-dom.development.js:18523 The above error occurred in the <Products> component:
at Products (http://localhost:3000/main.f01d7322f0afd7419d5f.hot-update.js:30:5)
at Routes (http://localhost:3000/static/js/bundle.js:40456:5)
at Router (http://localhost:3000/static/js/bundle.js:40389:15)
at BrowserRouter (http://localhost:3000/static/js/bundle.js:39198:5)
at App (http://localhost:3000/static/js/bundle.js:44:84)
Consider adding an error boundary to your tree to customize error handling behavior.
Visit https://reactjs.org/link/error-boundaries to learn more about error boundaries.
Here is the full project: https://github.com/burNN11/Project
import productItems from './data/Data'
const Products = ({handleAddProduct, productItems}) => {
console.log(productItems)
return (
<div className='produse'>
{productItems.map((item)=> (
<div className='produs' key={item.id}>
<div>
<img className='imagine-produs'
src={item.image}
alt = {item.name}
