-
Notifications
You must be signed in to change notification settings - Fork 519
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
consol error - Cannot read properties of null #27
Comments
In my Case it was causing because of cart context const getLocalCartData = () => {
let localCartData = localStorage.getItem("thapaCart");
const parsedData = JSON.parse(localCartData);
if (!Array.isArray(parsedData)) return [];
return parsedData;
}; that should work |
let getLocalCartData = JSON.parse(localStorage.getItem('userCartData')) ? JSON.parse(localStorage.getItem('userCartData')) : []; |
|
The easiest way is to change the 2nd line (if condition) in the following code in cart_context.js:
To:
|
cart Reducer.js:138
Uncaught TypeError: Cannot read properties of null (reading 'reduce')
The text was updated successfully, but these errors were encountered: