Building and Testing Customer Components
Explore building shared customer detail components and routable pages in Blazor. Learn to add create, edit, and delete functionality with proper validation and navigation to manage customers efficiently.
Building a shared customer detail component
Next, we will create a shared component to show the details of a customer. This will only be a component, never a page:
Step 1: In the Northwind.BlazorServer project, in the Shared folder, create a new file named CustomerDetail.razor. (The Visual Studio 2022 project item template is named Razor Component.)
Step 2: Modify its contents to define a form to edit the properties of a customer, as shown in the following code:
Building customer create, edit, and delete components
Now we can create three routable page components that use the shared component:
...