As you will have noticed already, every time we refresh the browser, our shopping cart's contents are lost. Both component- and application-level state are only stored in memory, apart from the catalog filter selections, which we pushed into the browser URL. As such, as soon as the browser is refreshed, that memory is cleared and we lose the state of our shopping cart.
There are a number of ways that we could solve this problem, including persisting the state into the browser's local storage, or pushing the state up to our API and persisting it in the database. Both of these options are completely acceptable and widely used approaches, but they also have their own pros and cons. Persisting to local storage in the browser is simple and effective, but if the user clears their browser cache, then they will still lose their cart items...