This chapter covers
- Composing elements to combine Blazor components
- Configuring components using attributes
- Displaying child content and creating templates
- Managing connection errors and application errors
In this chapter, I continue to describe Blazor Server, focusing on the way that Razor Components can be used together to create more complex features. Table 34.1 provides a guide to the chapter.
Table 34.1 Chapter guide (view table figure)
Problem |
Solution |
Listing |
---|---|---|
Creating complex features using Blazor |
Combine components to reduce duplication. |
3, 4 |
Configuring a component |
Use the Parameter attribute to receive a value from an attribute. |
5–10 |
Defining custom events and bindings |
Use EventCallbacks to receive the handler for the event and follow the convention to create bindings. |
11–14 |
Displaying child content in a component |
Use a RenderFragment named ChildContent. |
15, 16 |
Creating templates |
Use named RenderFragment properties. |
17, 25 |
Distributing configuration settings widely |
Use a cascading parameter. |
26, 27 |
Responding to connection errors |
Use the connection element and classes. |
28, 29 |
Responding to unhandled errors |
Use the error element and classes or define an error boundary. |
30–35 |
34.1 Preparing for this chapter
This chapter uses the Advanced project from chapter 33. No changes are required to prepare for this chapter.