Hi @MIPAKTEH_1,
Static rendering is the default in .NET 8. .NET 8 introduced the notion of Render Modes, and it is now required either at the page level, or globally. The default is static rendering which means that the component is rendered exactly as it is written with no interactivity being wired up by the Blazor engine.
To wire up interactivity, you have two options.
Per component solution Check for this directive at the top of the file(Counter.razor
here):
@rendermode InteractiveServer
Global solution Update Routes
element in App.razor
file:
<body>
<Routes @rendermode="new InteractiveServerRenderMode()" />
</body>
Be sure import the namespace in _Imports.razor
:
@using static Microsoft.AspNetCore.Components.Web.RenderMode
Note: Even though you have added AddInteractiveServerComponents()
this does NOT mean that you have set the default to be InteractiveServer. It only means that you have the option to add InteractiveServer as a global or component option. So you still must add the global or component option as above.
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
Best regards,
Rena