A medley of Blazor features
Your Blazor journey has just begun, and there are so many more features to Blazor than what we covered. Here are a few more possibilities to give you a glimpse of the options.
You can integrate Razor components with MVC and Razor Pages using the Component
Tag Helper. When doing so, you can also prerender your applications (the App
component) by setting the render-mode
attribute to Static
, leading to a faster initial render time. Prerendering can also be used to improve search engine optimization (SEO). The "drawback" is the need for an ASP.NET Core server to execute the prerendering logic.
Another lovely thing about full-stack C# is sharing code between the client and the server. Say we have a web API and a Blazor Wasm application; we could create a third project, a class library, and share the DTOs (API contracts) between the two.
In our component, we can also allow arbitrary HTML between the opening and closing tags by adding a RenderFragment...