C#C
C#3y ago
18 replies
schwartzmj

❔ Razor Component vs View Component vs Blazor

I do not want to use Blazor Client or Blazor Server. I just want to make view partials (Components) that I can pass parameters into to render my HTML.

Googling around is extremely confusing and I can't seem to get my project to recognize my Razor Components.

I started an ASP.NET Core Web App with Razor Pages. Let's say I just want to make a Heading component where I pass in a parameter
Title
equal to "Hello World". Right now, my HTML source is literally
<heading></heading>
as opposed to e.g.
<h1>Hello World</h1>
.

I've tried creating an
_Imports.razor
file where I do
@using Path.To.Components.Folder
amongst various other things and nothing seems to work. I feel like I'm finding conflicting information for Blazor vs Razor. Help?
Was this page helpful?