7

Building a Shopping Cart Using Application State

Sometimes, we need our applications to maintain their state between different pages. We can accomplish this by using dependency injection (DI). DI is used to access services that are configured in a central location.

In this chapter, we will create a shopping cart. As we add and delete items from the shopping cart, the application will maintain a list of the items in the shopping cart. The contents of the shopping cart will be retained when we navigate to another page and then return to the page with the shopping cart. Also, the shopping cart’s total will be displayed on all the pages.

Application state,

dependency injection

a team built on trust!

In this chapter, we will cover the following ...

Get Blazor WebAssembly By Example - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.