I have this razor component:
@using Microsoft.AspNetCore.Components.Forms
@page "/category/create"
@using BakingBeyondRecipesServer.Model
@using DataAccess.Data
@using Models;
Create New Category
@code {
private DataAccess.Data.Recipe Recipe { get; set; } = new DataAccess.Data.Recipe();
private DataAccess.Data.Category Category {get;set;} = new DataAccess.Data.Category();
private CategoryDto CategoryModel = new CategoryDto();
private void HandleValidSubmit()
{
// Perform actions on form submission
}
}
And I have those warnings:
Warning (active) RZ10012 Found markup element with unexpected name 'InputText'. If this is intended to be a component, add a @using directive for its namespace.
Warning (active) RZ10012 Found markup element with unexpected name 'EditForm'. If this is intended to be a component, add a @using directive for its namespace.
I don't know what I'm missing.
This is how it looks when I start the program:

Tuhin PaulPosted Mar 21, 2023, 3:56 PM
Some improvements:
Tuhin PaulPosted Mar 21, 2023, 3:56 PM
Instead of using @using DataAccess.Data and @using Models, it's better to specify the exact namespace that you need. This helps to avoid namespace conflicts and makes the code easier to read. For example, if you only need the Category class from DataAccess.Data, you can use @using DataAccess.Data.Category.
Also Rather than using Recipe and Category as variable names, it's better to use more descriptive names that convey their purpose. For example, if Recipe represents the recipe being created, you can use NewRecipe or RecipeModel. In the Name input field, font-control should be form-control. The code doesn't include any validation for the Name field. It's better to add validation to ensure that the user enters a valid category name.
Tuhin PaulPosted Mar 17, 2023, 1:39 AM
You need to add the using directive for the Microsoft.AspNetCore.Components.Forms namespace in order to use the InputText and EditForm components.
@using Microsoft.AspNetCore.Components.Forms
This should resolve the warnings.