I have a component which uses context and it works as expected when I include it in other components. But when I try to include that same component in a SweetAlert popup, I get the error:
Cannot destructure property 'cart' of '(0 , react__WEBPACK_IMPORTED_MODULE_0__.useContext)(...)' as it is undefined.
which means the component is not getting access to the context.
So when used outside of a SweetAlert popup, the component gets access to the context but not when inside the popup.
Please refer to this post.
I have a component which uses context and it works as expected when I include it in other components. But when I try to include that same component in a SweetAlert popup, I get the error:
which means the component is not getting access to the context.
So when used outside of a SweetAlert popup, the component gets access to the context but not when inside the popup.
Here's my code for firing the popup:
If I remove the component from the popup, the popup works as expected.