First experience with .NET8 Blazor’s Auto rendering mode
First experience with .NET8 Blazor’s Auto rendering mode After the release of .NET8, Blazor supports four rendering methods Static rendering, this kind of page can only be displayed, does not provide interaction, and can be used for web content display Using Blazor Server hosting through Server interaction Browser-side interaction using WebAssembly hosting Use Auto to automatically interact, initially using Blazor Server, and using WebAssembly to automatically perform interactive client rendering on subsequent visits. Auto-rendering generally provides the fastest app launch experience. Experience When creating a Blazor application through VS, select the new template Blazor Web App. During the process, you can see that there are four templates to choose from. We can choose Auto to experience it. After creating a new Auto, you can see that the project template has created two projects for us: BlazorApp and BlazorApp.Client BlazorApp is the startup project, and BlazorApp.Client is a component library Then you can take a look at the Program in the startup project. An obvious change is that Blazor in .NET8 opens Blazor Server by adding a plug-in. Two ways to interact with WebAssembly. If not added, it is actually static mode. builder.Services.AddRazorComponents() .AddInteractiveServerComponents() .AddInteractiveWebAssemblyComponents(); … app.MapRazorComponents() .AddInteractiveServerRenderMode() .AddInteractiveWebAssemblyRenderMode() .AddAdditionalAssemblies(typeof(Counter).Assembly);…
First experience with .NET8 Blazor’s Auto rendering mode
First experience with .NET8 Blazor’s Auto rendering mode After the release of .NET8, Blazor supports four rendering methods Static rendering, this kind of page can only be displayed, does not provide interaction, and can be used for web content display Using Blazor Server hosting through Server interaction Browser-side interaction using WebAssembly hosting Use Auto to automatically interact, initially using Blazor Server, and using WebAssembly to automatically perform interactive client rendering on subsequent visits. Auto-rendering generally provides the fastest app launch experience. Experience When creating a Blazor application through VS, select the new template Blazor Web App. During the process, you can see that there are four templates to choose from. We can choose Auto to experience it. After creating a new Auto, you can see that the project template has created two projects for us: BlazorApp and BlazorApp.Client BlazorApp is the startup project, and BlazorApp.Client is a component library Then you can take a look at the Program in the startup project. An obvious change is that Blazor in .NET8 opens Blazor Server by adding a plug-in. Two ways to interact with WebAssembly. If not added, it is actually static mode. builder.Services.AddRazorComponents() .AddInteractiveServerComponents() .AddInteractiveWebAssemblyComponents(); … app.MapRazorComponents() .AddInteractiveServerRenderMode() .AddInteractiveWebAssemblyRenderMode() .AddAdditionalAssemblies(typeof(Counter).Assembly);…