Skip to content Skip to sidebar Skip to footer

React+Redux:TypeError: Cannot Read Property 'address' Of Null

I am new to react. Now I am Facing a problem. My app is running well(a simple ecommerce).When I am entering a shipping address, it is running fine. But the problem is when i log ou

Solution 1:

There is a typo error on store.js file when you try to get shippingAddress from local storage. You wrote sgippingAddress but should be shippingAddress with the h.


Solution 2:

You have a typo in your store.js ;)

const shippingAddressFromStorage = localStorage.getItem('shippingAddress') ? 
    JSON.parse(localStorage.getItem('->sg<-ippingAddress')) : {}

You might consider using redux-persist, a nice library to persist your redux state to localStorage, indexDB etc.


Post a Comment for "React+Redux:TypeError: Cannot Read Property 'address' Of Null"