What this book covers
Chapter 1, Hello Blazor, will teach you the difference between Blazor server and Blazor WebAssembly. You will get an overview of how the technology works and a brief history of where Blazor comes from. Knowing the structure and differences between the hosting models is essential for understanding the technology.
Chapter 2, Creating Your First Blazor App, helps you understand how to install and set up your development environment. You will create your first Blazor app (both Blazor Server and Blazor WebAssembly) and learn about the structure of the project template.
Chapter 3, Managing State – Part 1, teaches you how to create a repository to store your data (blog posts, categories, and tags).
Chapter 4, Understanding Basic Blazor Components, digs deeper into components, life cycle events, adding parameters, and sharing parameters between components. You will also create reusable components in this chapter.
Chapter 5, Creating Advanced Blazor Components, digs even deeper into components, adding functionality such as child components, cascading parameters, and values, and covering how to use actions and callbacks.
Chapter 6, Building Forms with Validation, looks at forms, how to validate forms, and how to build your own validation mechanism. This chapter will cover the most common use cases when handling forms, such as file upload, text, numbers, and triggering code when checking a checkbox.
Chapter 7, Creating an API, looks at creating an API using Minimal API. When using Blazor WebAssembly, we need an API to get data.
Chapter 8, Authentication and Authorization, looks at adding authentication and authorization to Blazor and making sure navigation, such as redirecting to a login page, works as expected.
Chapter 9, Sharing Code and Resources, teaches you how sharing code between Blazor WebAssembly and Blazor Server projects can be shared by adding all of the things you need into a shared library. In this chapter, you will build a shared library that can be packaged as a NuGet package and shared with others.
Chapter 10, JavaScript Interop, explores how you can leverage JavaScript libraries when using Blazor and make calls from C# to JavaScript. You will also look at how JavaScript can call C# functions in our Blazor app.
Chapter 11, Managing State – Part 2, looks into the different ways of managing state (persisting data), such as using LocalStorage or just keeping data in memory using dependency injection. You will also implement real-time updates to your blog post using SignalR.
Chapter 12, Debugging the Code, teaches you how to debug your applications and add extended logging to figure out what’s wrong with your application. You will not only look at traditional debugging but also at debugging C# code directly from within the web browser.
Chapter 13, Testing, looks at automated testing so that you can make sure your components work as they should (and continue to do so). There is no built-in method to test Blazor applications, but there is an excellent community project called bUnit.
Chapter 14, Deploy to Production, will take you through the different things you need to think about when running Blazor in production.
Chapter 15, Moving from, or Combining an Existing Site, will show you how to integrate Blazor into an existing site and combine JavaScript frameworks like Angular or React with Blazor.
Chapter 16, Going Deeper into WebAssembly, covers the specific things for Blazor WebAssembly.
Chapter 17, Examining Source Generators, covers how Blazor relies heavily on source generators. In this chapter, you will learn how they work and relate to Blazor.
Chapter 18, Visiting .NET MAUI, looks at the third hosting model, Blazor Hybrid. Using .NET MAUI, you can build iOS, Android, macOS, Tizen, and Windows applications by leveraging what you have learned in this book.
Chapter 19, Where to Go from Here, is a short chapter with a call to action, some resources you can use, and a finale.