Last month I tweeted about a blog post I found interesting:
#Blazor apps are built using #Razor components.
But did you know you can use Razor Components in existing Razor Pages or MVC Views? https://t.co/dTL3e3Md2O#dotnetcore #aspnetcore pic.twitter.com/oi2f3POYEQ
— DalSoft (@DalSoft) January 16, 2020
I thought it was really cool that you could use Razor Components in existing ASP.NET Razor Pages (which is what you build Blazor apps with). I think Razor Pages are one of the easiest ways to develop a web app using ASP.NET Core. Also some things such as authentication are still better served by a ‘traditional web app’ – for example Razor Pages is the default for ASP.NET Identity.
This is why I was glad that this functionality was added to ASP.NET 3.0 Razor Pages and MVC Views, it means a modern alternative to view components and partial views. It also gets you familiar with Razor Components which are the building blocks of a Blazor App.
TL;DR
I have created a nuget package that means in Razor Pages you can use your Razor Components like this:
<hello-world message='$"Hello World {DateTime.Now}"' />
Instead of like this:
<component type="typeof(HelloWorld)" render-mode="Static" param-message='$"Hello World {DateTime.Now}"' />
Recent Comments