I have created a TestComponent.razor
@typeparam TValue
@code {
private TValue Type { get; set; }
[Parameter] public string String { get; set; }
}
In the index.razor page I have the following:
@page "/"
<h1>Hello, world!</h1>
Welcome to your new app.
<SurveyPrompt Title="How is Blazor working for you?" />
<ComponentFactory.Data.SampleComponent TValue="@myType" String="@myString"></ComponentFactory.Data.SampleComponent>
@code{
Type myType { get; set; } = typeof(string);
string myString { get; set; } = "hello";
}
I cannot pass Type myType into TValue, unless I make myType a @typeparam of the current page
Why is this happening and is there a way to pass variables into a component's @typeparam?