Summary of Using Application State

Let's summarize the concepts we learned in the “Building a Shopping Cart Using Application State” chapter.

We'll cover the following

Wrap up!

We should now be able to use DI to apply the AppState pattern to a Blazor WebAssembly app.

In this chapter, we introduced application state and DI. After that, we used the Empty Blazor WebAssembly App project template to create a new project. We added a shopping cart to the project and demonstrated that application state is lost when we navigate between pages. To maintain the application's state, we registered the CartService service in the DI container. Finally, we demonstrated that by using the AppState pattern, we can maintain the shopping cart's state.

We can apply our new skills with DI to maintain the application state for any Blazor WebAssembly app.

Get hands-on with 1200+ tech skills courses.