-
Book Overview & Buying
-
Table Of Contents
Web Development with Blazor - Fourth Edition
By :
To make our components even more reusable, we can supply them with a piece of Razor syntax. In Blazor, you can specify a RenderFragment, which is a fragment of Razor syntax that you can execute and show.
There are two types of render elements: RenderFragment and RenderFragment<T>. RenderFragment is simply a Razor fragment without any input parameters, and RenderFragment<T> has an input parameter that you can use inside the Razor fragment code by using the context keyword. We won't go into depth about how to use this now, but later in this chapter, we will talk about a component (Virtualize) that uses RenderFragment<T>, and in the next chapter, Chapter 8, Building Forms with Validation, we will implement a component using RenderFragment<T>.
We can set RenderFragment as the default content inside the component tags and give it a default value. We will explore this next and build a component using these features.
We can also return a RenderFragment...