March 2020
Intermediate to advanced
328 pages
7h 58m
English
A Channel is the perfect place to store our shopping cart state and to handle user input on the cart. We’ll write a ShoppingCartChannel module that handles adding items, removing items, and synchronizing clients. We’ll also add real-time stock updates in the next section.
Remember that Channels are just processes—we’ll use this to our advantage here. Each ShoppingCartChannel represents one open instance of Sneakers23, and the state of the Channel at any time will match what the shopper sees on their page. The Channel is in charge of sending its client the different item details, such as name and availability, for each shoe in the cart.
Let’s start by writing the basic ShoppingCartChannel—we’ll incrementally ...
Read now
Unlock full access