.NET 8 Preview 6 is the latest preview release of .NET 8, which is expected to be released later this year. It includes many new improvements to blazor, such as:
Form model binding and validation with server-side rendering: Blazor’s new server-side rendering mode can now bind and validate data from HTTP form post values. This means you can use data annotations to specify validation rules for your model classes and display error messages in your UI. You can also use the [SupplyParameterFromForm] attribute to bind data from the form request to your component properties.
Enhanced page navigation and form handling: Blazor now supports more scenarios for navigating between pages and handling form submissions. You can use the NavigationManager.NavigateTo method to navigate to a different page with or without reloading the app. You can also use the NavigationManager.LocationChanged event to react to changes in the URL. You can use the EditForm.OnSubmit event to handle form submissions without reloading the page.
Preserve existing DOM elements with streaming rendering: Blazor’s streaming rendering mode can now preserve existing DOM elements when streaming updates into the page. This means that the UI will not flicker or lose focus when new content is added or removed. This provides a faster and smoother user experience.
Specify component render mode at the call site: You can now specify the render mode for a component instance using the @rendermode directive attribute. The render mode determines how the component is rendered on the page: static (no interactivity), server (server-side rendering), server-prerendered (server-side rendering with interactivity), or webassembly (client-side rendering). This gives you more control over how your components are rendered.
Interactive rendering with Blazor WebAssembly: You can now enable interactive rendering of components with Blazor WebAssembly. This means that you can have components that are initially rendered on the server and then switch to client-side rendering when the user interacts with them. This can improve performance and reduce bandwidth usage by only loading the necessary code and data on demand.
Blazor template consolidation: As part of unifying the various blazor hosting models into a single model in .NET 8, Microsoft has also consolidated the number of blazor project templates. In this preview release, they have removed the Blazor Server template and the ‘ASP.NET Core hosted’ option from the Blazor WebAssembly template. Both of these scenarios will be represented by options when using the new Blazor Web App template.
These are some of the major updates to blazor in .NET 8 Preview 6.