Everything about software and data solutions

New Blazor in .NET 8 - the killer of JavaScript Web frameworks

That would be amazing if we, C# developers, could only code C# for Back, Front and Mobile
I was coding backend with .NET and front with ReactJS, when I was a full-stack developer. “That would be amazing if we, C# developers, could only code C# for Back, Front and Mobile” — I was dreaming. Switching between C# and TypeScript, Visual Studio and VS Code put a lot of stress on me. Unfortunately, no solid solution for C# coders could match the advanced JavaScript frameworks at that time. So, every full-stack in Australia had to know those two different universes to compete in the enterprise market.

However, in late 2019, Blazor Server was released. The framework provided functionality for Single Page Applications (SPA), rendering only modified UI components. All the logic was calculated on the server, which often forced users to watch a half-empty screen waiting for the content without much interactivity. JavaScript frameworks offered well-advanced infrastructure, functionality, styled components, themes, templates, got wider community support, etc., pushing Blazor well behind.

Then, we got Blazor WebAssembly in late 2020. Blazor WebAssembly puts rendering and logic on the client side, making the app more interactive. This made Blazor stronger. However, the enterprises still preferred a reliable and tested combination of ReactJS or AngularJS plus .NET as the backend.

And that's why I'm so excited about the new updates for Blazor in .NET 8. It's so promising, so I'm seriously considering switching back to full-stack development. Who knows 😊

First, I'd like to highlight proper Server-Side Rendering (SSR) without keeping the SignalR connection constantly open. All the communication will happen through HTTP request/response. This should speed up the page loading time, enable the static content, improve SEO and SMO, and improve security.

The next big thing is Streaming Rendering, which should be perfect for pages that require difficult and processor-consuming calculations as well as bulk datasets. New Blazor will be able to render the static part of the page first and then dynamically load the remaining content. Again, no SignalR connection, just pure HTTP.

Another significant update is Enhanced Navigation and Form Handling. When a user navigates to another page, only updated UI elements should re-render, improving performance and interactivity. If the user submits a form, they should stay at the exact location on the page. Previously, the whole page was re-rendered during the "form submit", forcing users to land back at the top of the page.

What if you don't know the type of rendering your app requires and you want to identify it later? You got it covered by the new Blazor with its component's Runtime Rendering feature!
.NET 8 will deliver even more great features for Blazor, like better performance for WebAssembly (the team promises 20% faster UI rendering and 2x faster JSON serialization), new components added, API for authentication, sections, static HTML for static Web Sites and Emails, etc.
For the past five years, Blazor has received many libraries with styled components, themes, and templates. We even have an IDE with a visual page builder. More than that, MAUI for cross-platform mobile and desktop development was released in May. Why MAUI? – Because it has a template for Blazor, meaning you can have the same codebase for your Web and Mobile app. Isn't that great?

Yes, the title is a bit cheese 😜 JavaScript frameworks will continue to grow, and JavaScript developers will continue to use them. However, we, C# developers, may finally get a pure .NET C# framework that we can fully apply and enjoy without the need to go anywhere else. Hopefully, the new Blazor will even cure us of those nightmares related to NMP, yarn, VS Code and JavaScript.

For those at the beginning of their journey, I'd highly recommend considering Blazor. Microsoft invests a lot of resources into the technology, and I feel it has a bright future.

Thanks for reading, and have a wonderful day! Remember to comment, like and share! 😁
2024-03-05 10:51 Tech