Summary
You 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.
In the next chapter, we will build a Kanban board using events.