Category: Blazor Posts

How to Use Templated Components in Blazor

What is a templated component? Templated components are components that accept one or more UI templates as parameters. This is then used as part of the rendering logic. This allows users to author higher-level components that are highly reusable. I am going to cover a list component that allows a user to specify a template…
Read more

How Routing in Blazor Works?

Introduction In Blazor, the route template provided to the accessible components makes the routing possible. A Blazor component (which is a Razor file with .razor extension) with @page directive, when compiled, generates a class. This generated class is given a RouteAttribute that specifies the route template. At runtime, the router looks for matching route templates…
Read more

How Lifecycle methods in Blazor Work?

The Methods in the Lifecycle of Blazor App During their lifecycle, Blazor components undergo the following synchronous as well as asynchronous lifecycle methods OnInitialized()/OnInitializedAsync() – These are invoked when the component is ready to start, having received its initial parameters for its parents in the render tree. For an asynchronous operation, this method is overridden…
Read more

How Inheritance in Blazor Works?

The ComponentBase Class When a Blazor component is created, it should inherit from the ComponentBase class. The first reason for so doing is that it implements the IComponent interface which Blazor uses to locate components throughout the project. Secondly, ComponentBase contains important lifecycle methods. Let’s continue with the GetStarted Blazor solution that we created here…
Read more

Learn Chained Bind in Blazor

What is Chained bind in Blazor? Multiple levels of binding occur at the same time in a “chained bind”. In a chained bind, the event handler and the value must be specified separately i.e. @bind syntax can’t be used to implement chained bind in the page’s element. A parent component however can use the @bind…
Read more