Before we can start building a shopping cart, we need to decide how we're going to do it. We have a number of options available to us, each with their own respective pros and cons. We need a way of storing selected products somewhere until the user is ready to complete their purchase and we can persist their order in the database. Without including any additional technologies in our stack, we have three main options to choose from—one of which is client-side only, and the other two require API calls to the server.
Evaluating our options
Persisting to the database
Persisting to the database is probably the most obvious option, but is also the most complicated. On the face of it all, what we need to do is add a...