Skip to content
Demo project to go with the Organizing and Naming Components in Blazor article on my blog
HTML CSS C# JavaScript
Branch: master
Clone or download

Latest commit

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
DemoRazorClassLibrary
NamingStuff
.gitignore
NamingStuff.sln
README.md

README.md

Organizing and Naming Components in Blazor

Demo project to go with the Organizing and Naming Components in Blazor article on my blog: https://mariomucalo.com/organizing-and-naming-components-in-blazor

My basic rules are:

  • have the view and the code behind in two separate files
  • the code behind file is named the same as the view file with the .razor.cs extension - this will allow nesting of files in the Visual Studio IDE
  • I use Razor components for both Pages and Components. I put pages in the /Pages folder and components in the /Components folder (or in a separate Razor Class Library).
  • Pages are components that can be accessed via URL - meaning they have the @page "/my-route-here" annotation. The file name should contain Page in the end (e.g. IndexPage.razor)
  • Components need to have Component in the file name (e.g. MyDemoComponent.razor)
You can’t perform that action at this time.