How can I pass parameter into razor component?
So far I tried
@(await Html.RenderComponentAsync<Rateplan>(RenderMode.ServerPrerendered, new { id= 100}))
But I receive an error
InvalidOperationException: Prerendering server components with parameters is not supported.
I try the same thing with RenderMode.ServerPrerendered but I receive an error
InvalidOperationException: Server components with parameters are not supported.
I also tried doing
<Rateplan Id="100"></Rateplan>
but that didnt even start the component.
In the component where you want to accept the parameter you need to have a Property marked as a parameter
Like
[Parameter]
public List<Player> Players { get; set; }
Then you should be able to pass in the parameter as
<Componentname Players="@players"></Componentname>
(In this example @players is a local variable)