Blazor is a replacement of React

Blazor is a replacement of React

Come at me bro

·

3 min read

Versus

I've seen a lot of articles pitting Blazor against Javascript SPA frameworks (React, Angular, Vue), enumerating the pros and cons of each and then reaching the anodyne conclusion that "you should choose the solution that best fits your needs".

Yawn.

If your needs are "build and maintain a modern web app", then I can save you the trouble. Use Blazor.

Fighting words? I don't think so. Comparing React to Blazor is like comparing a sharp rock to a scimitar. Blazor by design is an evolution of SPA development that replaces js frameworks.

It is unclear to me why this is so widely misunderstood. My hunch is reviewers haven't actually used Blazor.

Blazor is approximately one million times easier to work with than React, and it's evident immediately upon creating a Blazor project from a template. It just works and requires no fiddling with webpack and its insane config or the crows nest of package dependencies.

Legitimate cons?

The arguments against Blazor I've seen are something along the lines of:

It's slow

The only legitimate con of using Blazor I've seen is that it is 'slow'. This criticism is often two concerns conflated accidentally though.

It can be slow on initial load because it must pass the .net runtime and other libraries to the client (It's heavy). This is not a deal breaker in most instances, however, and it will improve over time with optimizations to deployments and CDNs.

They sometimes mean it runs slowly in the browser, which simply isn't true unless the implementation is not intelligent. You can bog it down if you aren't paying attention (just like any other system).

It requires a good internet connection

... Really? This complaint is bizarre to me whenever I see it when talking about any web technology. The concern here is a shaky internet connection, which a) describes any connection on a bad day and b) really only applies to server-hosted Blazor because it uses signalR.

SignalR can be an issue from a scaling perspective and is a legitimate factor to consider.

OR

You can just use client-side hosted webassembly Blazor. The internet outage scenario does not apply, as the app lives entirely in the browser and therefore suffers naught when the connection dies.

Tooling sucks

It has rapidly improved, and hot reload specifically has been released for visual studio, and it works. This complaint is moot.

So what's so great about it?

It is easy to use

Seriously, I have never been able to stand up a complex interface so quickly. It is a dream to work with.

You can use C# almost exclusively

But can use Javascript when necessary. Any complaint against using C# as a language is weak in my opinion.

Plus, most front-end developers have adopted TypeScript (by Microsoft) in VSCode (also by Microsoft) which looks suspiciously like C# for some reason.

Minimal framework binding overhead

The thing I hate most about React is the nightmare of binding code you have to write in Javascript to make everything work.

You must essentially participate in the wiring of the framework, which is tedious and error-prone thanks largely to Javascript as a nutty language with confusing implementations of stuff like scoping.

None of this is necessary in Blazor, it just handles it for you with minimal direction.

Go check it out

If you do any sort of web or SPA development, definitely give it a whirl.