How to inherit a component in Blazor

preview_player
Показать описание
A quick video on Blazor component inheritance. In this video you gonna learn how to inherit a Blazor component with all the C# code and the markup as well.

📁 Project source code:

🐦Twitter:

✅ Support me on Patreon:

⚙️ My setup (affiliate links) ⚙️
Рекомендации по теме
Комментарии
Автор

0:06 What do you guys think about the intro transition? Should I keep using it for Blazor videos?

QuickzDev
Автор

Nice one! This is a great simple way of guaranteeing some conformity throughout the app.

chrismingay
Автор

You saved my day! I am new to blazor. Couldn't figure out why I can't use my razor page from razor library in my WebAssembly blazor project. After using 1:29 it finally works. Now the question how?

mikemike
Автор

thanks, its a good explanation of how to use inherit of blazor type!

Nathantsang
Автор

Buuut you can only put new markup after that of the base class. I need something more like a RenderFragment that can be provided by the derived class and being integrated in the base classes markup (and of course without builer.OpenElement etc).

wassollderscheiss
Автор

Could this be used to create a custom "base component" (that of course inherits the built-in ComponentBase) that has properties and functions that many components need? For example, I tend to use an IsBusy boolean flag on many of my components, and I'd rather declare it in a base component so I don't have to write duplicate code in all of my components.

diegoronkkomaki
Автор

Don't do this. Instead create a cs class and inherit from the razor component. Set the parameters in the contructor. Then to show the inherited class on screen just use the inherited classes name in a razor tag.

alexhall