Mern Ecommerce Series-27-28

1
Posted at January 20, 2021 57 Views . 0 Saved .

When we choose category from categories after selecting any category the error comes

TypeError: Cannot read property 'type' of undefinedonCategoryChange C:/Users/ACER/Desktop/mern-ecommerce/admin-app/src/containers/NewPage/index.js:50 47 | const onCategoryChange = (e) => { 48 | const category = categories.find(category => category._id === e.target.value); 49 | setCategoryId(e.target.value); > 50 | setType(category.type); | ^ 51 | } 52 | 53 | const handleBannerImages = (e) => {

India
Practicing MERN Stack from Rizwan Khan Video Tutorials
2 Comments
fauzan shaikh
setType(category.type); this was the problem the function was not changed in the Modal thank you for your response.
Rizwan Khan
your onCategoryChange funtion is receiving an undefined argument thats why you are getting this error plz debug it and see the arguments