React vs Blazor: What you said
by John Browne, on Feb 8, 2023 3:46:15 PM
Last week I promised to let you know what you--that is, at least some of you--told me what you thought about React or Blazor as a front-end replacement for Web Forms applications.
If you haven't read it, the TL;DR is I asked folks about their preferences and Blazor took the win by a large majority. I will say, however, that a considerable percentage were on the virtual fence: don't care, don't know, or not applicable.
Before I get into specifics, let's take a peek at the differences between these two web front-end solutions. Note both of them are client-centric, as opposed to a lot of more traditional (ASP.NET I'm looking at you) architectures that require server round trips for much of the UI view updates.
What is Blazor?
Just like ASP.NET and Webforms, Blazor code lets you mix HTML and C# code together, like in the following example, where you have HTML calling a C# method to increment a variable.
Blazor has gained a lot of traction since launch, mainly because of the tight integration with .NET and also because it is fast.
What is React?
React uses a virtual DOM (Document Object Model), which allows for efficient rendering of UI components. React updates only the necessary parts of the DOM when changes occur, resulting in improved performance and a smoother user experience. This is similar to a technique we (Mobilize.Net) use in our WebMAP architecture, where we update UI elements selectively.
Here, courtesy of react.dev/learn is a React sample that declares a JS function and then displays/formats it in HTML. Also cool, huh?
So let's cut to the chase, and find out what you--the developer public--actually said.
What you said about Blazor vs React
What did folks say about their choices? Some of the more common or interesting points I heard below:
- React is more common, used everywhere and also by mega-large platforms (think Facebook and Twitter)
- "Concerned about Microsoft yanking the rug out on something like that..."
- "Blazor is about 5 years old...big question is will it be around in 10 years? You know how Microsoft gets all excited about new technology and then ditches it when something else catches their eye."
- "A distributed UI platform has been a moving target since the advent of the web...we are fine with either but going with Blazor. At some point we will diversify, but feel good with WASM being a standard."
- One person was happy with Blazor server, so thought he would go with Blazor for front-end as well.
- "I think you should convert over to React. In all my time working in observability space ... I saw Blazor exactly once (just last week) and not in any positive way. Meanwhile, half of the sites in the world are on React, for better or worse. Go for it."
- "We are moving forward with React for new projects as well as migrating to React from existing web applications that are on older tech stacks."
- "Most of the customers I work with would be fine getting to Blazor, and then over time adding new functionality as React or Angular, since it gets them off Windows, moves to the ASP.NET Core (which Blazor uses)."
- "By adopting Blazor (and its various flavours: Server, WASM, Hybrid,…), .NET developers have a single technology stack (.NET) to learn in order to build every kind of applications that they can think of."
- "I can totally see where you’re coming from with Blazor. It’s still so new, and without a long history of being supported by Microsoft, implementing it is risky. Given that, and the sheer scope of the implementations of React / Angular, it would make significantly more sense to me for you to go that route."
- "We had initially done our backend work in asp.net core and our front end in React. The complexity of React made us re-evaluate what we were doing and switched all of our front-end web to Blazor."
- "For me, Blazor has been working great, and since I decided to integrate .NET MAUI with Blazor, it helped me reduce the need of code duplication, or use lots of different technologies."
- "Both are good. My recommendation would be Blazor. Devs coming from a web forms background will feel right at home."
And finally, this response: We don’t have any have legacy ASP.NET web forms apps. One thing in our favor.
There you have it, right from the source.
Got Web Forms? Want something better? Check out our offerings here.