I have a problem with useContext because it returns undefined to me. could you please help me?
Uncaught TypeError: Cannot destructure property 'course' of 'Object(...)(...)' as it is undefined.
1 Answer 1
courseGlobal is your context. you should pass courseGlobal to useContext but you are passing ContextCourse that is a provider not a context
answered Oct 28, 2021 at 9:13
Reza Mirzapour
4534 silver badges12 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
lang-js
useContext(courseGlobal)not theContextCoursewhich is actually yourProvider, not yourContext