DEV Community

Misty Islam
Misty Islam

Posted on

help me what is the problem here

Image description
Image description

Top comments (5)

Collapse
 
dreamhollow4219 profile image
Ian

Is it supposed to read as "handleProduct" or handeProduct"?
I just wanted you to be aware of the name in case there are problems later.

Collapse
 
brense profile image
Rense Bakker

You have a scoping issue in your code. things (like handeProduct) that you define inside of a closure, will not be available outside of the scope of that closure. Read more about JavaScript closures here: developer.mozilla.org/en-US/docs/W...

Collapse
 
mistyislam5 profile image
Misty Islam

Thank You

Collapse
 
feijens profile image
☀️

Hi, you're defining the function "handeProduct" inside the useEffect so it's only available inside the useEffect scope. Define the function outside the useEffect :)

Collapse
 
mistyislam5 profile image
Misty Islam

Thank you