1.15K viewsMern Amazona
0 Comments

Hello Basir,
I am following your MERN Tutorial uploaded on your youtube channel named *Coding with Basir* and the video link: “https://www.youtube.com/watch?v=CDtPMR5y0QU&ab_channel=CodingwithBasir”. when I am doing the add-to-cart operation I am getting an error and the project is not loading. the error appears on the console of the browser error message as follows

“Uncaught TypeError: Cannot destructure property ‘state’ of ‘(0 , react__WEBPACK_IMPORTED_MODULE_3__.useContext)(…)’ as it is undefined.”

as my code and your code are just the same.

Bassir Unselected an answer November 27, 2023

I’ve done destructured import than also it’s prompting an error.

Bassir Unselected an answer November 27, 2023

hello there,

the useContext import is incorrect. compare your code with this please:

https://github.com/basir/mern-amazona/blob/master/frontend/src/screens/CartScreen.js#L1

Bassir Answered question October 13, 2022