Our cart application is working well. One thing you might have noticed is that if you reload a page, the current state of the application gets wiped out.
This is where Browser Local Storage comes in handy to persist data through refreshes of the application.
This is a side effect that we want to happen any time state changes in our app. React handles this with the useEffect
hook. In this hook, we will use the window.localStorage
API to set and get cart data in our application.