<div id="Counter">
    @(await Html.RenderComponentAsync<Counter>(new { IncrementAmount = 10 }))

why would i use this when i can just use

<counter IncrementAmount="10"/>

"When the page or view is rendered, components are prerendered at the same time."



1 Answers

Chris Sainty On Best Solutions

The code sample you’ve quoted is used when you want to include a Blazor component into a MVC view or a Razor page. If you’re just writing a standard Blazor app then you wouldn’t need this syntax.

When using this syntax the component is going to be prerendered on the server and will become interactive once a SignalR connection has been established with the client browser.