When it comes to websites, simple is almost always better - even if it's not pretty. This is especially true if you care about search engine results.
Why? Because you're here reading this. This blog post is one of our most popular blog posts on our site. And we know you got to us almost entirely from a Google referral. We know this because SEO is our most important focus when building an external-facing web app.
So with these things in mind, feel free to take these opinions with a grain of salt.
I went through the Pluralsight training course Building a Website with React and ASP.NET Core a while back. It was a great course, and taught a lot about getting the two to work together. What struck me is how limited they are in their interactions together. Some takeaways:
- Server Side Rendering (SSR) is vital for Search Engine Optimization (SEO), a critical requirement for the web apps we're building for customers - and ourselves.
- React on the server does SSR, but so does ASP.NET. However, to get React to do SSR, you have to build the React server side infrastructure manually.
- ASP.NET's function for client and server side rendering is that of the API layer, and pretty much nothing else.
- You don't get SSR out of the box with the create-react-app, the amazing React starter kit tool. In fact, you pretty much have to 'break' CRA in order to get SSR to work, thereby making it pointless (more or less) to use CRA with your app.
For .NET developers looking to migrate, it doesn't appear that moving into React SSR gives you a lot of benefits - especially with all of the performance and scaling features and improvements in ASP.NET Core. Indeed - unless you were highly comfortable with 'full stack' NodeJS development, and security isn't a big requirement, I'd say there isn't much reason to move into it - on the server side, that is. For client-side features, it may be another story...You can also use the Gatsby static site generator for your React application, which does offer some SEO capabilities. But readability isn't a strong feature when peering into the source code of a React-driven application.
When to use ASP.NET
Use a good server-side rendering engine like ASP.NET Core when you want to build readable HTML in your web applications. Simple as that. Use it if SEO is important to you.
There's no shortage of great JS frameworks - Vue, React, etc. are great choices. Svelte is one of our favorite frameworks at the moment - it's one of the smallest, fastest, developer-friendly frameworks out there.
You can have both if you know what you're doing
At the end of the day, it boils down to a question of
Unsure of how to get started in your next big application? Looking for someone to bounce ideas off of? We're here to listen with a free consultation and competitive pricing!