john-smilga / react-phone-e-commerce-project

144 stars 117 forks source link

Issue when refreshing the cart page #4

Open dipranjans opened 4 years ago

dipranjans commented 4 years ago

Hi, how to resolve the data lost when refresh the cart page?

What's the best way to handle this?

rAndrade360 commented 4 years ago

You can do a trick with react's localStorage and save the cart to the customer's browser. So, when you restart the component, you would look for this information in localStorage.

The other way is using redux and redux-persist. It automates the persistence process, saving the information in the best way in the user's browser.