loading...
Cover image for Working with .Net Core & React - what I've learned

Working with .Net Core & React - what I've learned

alexandrudanpop profile image Alexandru-Dan Pop Originally published at blog.alexandrudanpop.dev ・Updated on ・4 min read

I have been using both of those 2 awesome technologies for some time. From the point I started using React, I had a slow migration to the JS ecosystem and started to do more frontend work and less backend work using .Net.

Lots of folks like ASP.NET Core. 🌟

see the 2020 stack overflow dev survey

In this article, I don't compare them - just telling a few my personal impressions of both ecosystems.

It's mostly about what I like or dislike about both the ecosystems & their tooling. πŸ‘€

Why those two?

Both React and .Net Core are baked up by tech giants. πŸ—Ώ
This makes picking those technologies easy for decision-makers.

The React ecosystem

React is the dominant go-to solution when it comes to building web applications.

Some advantages:

  1. the ecosystem is huge and more vibrant
  2. great tools are free - ESlint, Prettier, Typescript, HMR (hot module replacement) - the JS community really has the lead when it comes to DX
  3. Monorepo tools
  4. An inclination towards FP (functional programming) instead of OOP (object-oriented programming)
  5. Some advantages are due to working with JS - like the ease of using JSON data and doing object manipulations
  6. More and more traction to Typescript in the last few years - I think this is a great quality boost for the ecosystem

Some disadvantages:

  1. things get deprecated (see examples below)
  2. using TS doesn't give that seamless typed language experience (yet) as C# does. TS has escape hatches that can make TS code weekly typed (this can be also a benefit for some people)
  3. Things move much fasterΒ - and it's harder to stay up to date
  4. Standards are still missing in the React ecosystem. This is a good and a bad thing because each project will look very different - from folder structure to the way components are written, to what CSS technology is used in the project. This is somehow nice because it leaves a lot of room for new innovation, but still, it feels like some standards are missing

Examples of deprecation in the React world:

  1. You learned React class components years ago and became an expert using them and all the lifecycle methods and all the class-based patterns. Well...bad luck, React function components with hooks are the new standard (don't get me wrong I absolutely love hooks ❀️).
  2. If you learned unit testing React components 5 years ago you might have learned Enzyme. At least from let's say 2019 (when also hooks were released), Enzyme is not encouraged to be used in React projects anymore. React Testing Library is the new standard, which has a totally different approach and different testing concepts (that are better). To put this in contrast - if you used .Net and learned to unit test your code with xUnit and Moq, maybe 5 years ago, you would still use those and be encouraged to do so
  3. You learned some complex state management solution and now there are talks in the community that you should not use it anymore - but maybe you should πŸ˜‰

Examples of missing standards in the JS world:
Just to give some context - there are 3 popular bundlers / build tools (webpack, parcel, rollup). There are more than 4 popular Rendering libraries (React, Vue, Svelte, Angular). There are at least 10 different ways of doing data fetching in React (with redux using your own middleware, sagas, thunks, redux-observable, useEffect, RxJs, react-query, swr, etc)

.Net core

A more mature community who figured out doing things in certain ways.
Now the .Net core ecosystem is obviously not as popular as the React ecosystem. When it comes to server-side applications or API's there is no clear winner, but we can certainly say .Net Core is one of the trending top picks in the world of APIs & backends.

Some advantages:

  1. A more consistent way of building server-side apps
  2. More stability - the best practices you learn today will probably be also around 5 years from now
  3. Both C# & F# are excellent languages that evolve a lot over time
  4. It's just great for building Web APIs, background services, etc
  5. Microsoft owns .NET, so you will get a pretty nice experience using .Net/.Net Core on other platforms they own - Azure, Azure Devops, Github

Some disadvantages:

  1. Lacks the advanced OSS tooling in the JS world - for more advanced linting, refactoring tools, code formatting you need to pay (ex for Resharper or Rider)
  2. Lacks monorepo tools (at least I don't know any)
  3. The community is not so vibrant. And a lot of folks are not so open to sharing things. This ecosystem would have great success if people would be more open and share things more

Is it worth knowing both?

Yes! While a lot of new people join programming and try to learn React or some other Javascript framework first, I would actually encourage them to learn a pure backend language first.

Why? It helps focus on pure coding and avoids learning at first all the complexities of the Web.

Aside from this, it's an incredible stack to master, as .Net Core offers a consistent way to build complex backends, and React helps you build complex interactive user interfaces.

Leave a 🧑 & πŸ¦„ if you like this article, also check out my Twitter where I post more cool content.

πŸ‘‡ Comment below πŸ‘‡

Let me know what you think about the .Net Core & React combo.

Is it worth learning C# with .Net Core or should we just use Node.js server-side and use the same language everywhere?

Discussion

pic
Editor guide
Collapse
jwp profile image
John Peters

Now the .Net core ecosystem is obviously not as popular as the React ecosystem.

.NET is backend only, there's no comparison here other than popularity.

Lacks the advanced OSS tooling in the JS world - for more advanced linting, refactoring tools, code formatting you need to pay (ex for Resharper or Rider

Not true, Visual Studio is free! There no better IDE in the world than Visual Studio. For me I'd never touch ASP.NET Core using only VS Code.

The community is not so vibrant. And a lot of folks are not so open to sharing things. This ecosystem would have great success if people would be more open and share things more

In general a true statement, the ASP.NET world existed before open source and NPM, so there's not a lot of continuous chatter about it. ASP.NET is just a stable, constantly progressing state-of-the-art product. The amount of engineering behind it is massive. Plus it's one of Microsoft's only footholds (other than Typescript) into the web world. MSFT won't let it die and NODE backend isn't there yet popularity wise.

I wouldn't say the community is not vibrant as there's over 20 years of ASP.NET work which has gone on before now. That amounts to a huge community. Things just work so what's there to chatter about?

And a lot of folks are not so open to sharing things.

This is true, I recall when NPM showed up the world. At the time MSFT had their own concept an sites to do the same thing. It never amounted to much and finally they retired it, moving to GitHub concepts for C# stuff.

But even so, there was a silence among the C# crowd in my opinion and a lot of flamers on StackOverflow for C# questions. Many of the folks were just mean to new folks in my opinion. Even the experts were more prone to tell you how dumb your questions was because before answering they'd say things like "Why would you want to do that?". etc. etc.

Is it worth it today to be a PolyGlot? Absolutely, the only problem now is what languages do you want to know?

You may be surprised to know that the Java Spring community is huge. It surprised me. Even so, JQuery is still #1 according to S.O. dev survey this year. React is 2nd and Angular 3rd.

One thing is for sure, the industry is slow to catch up which gives us plenty of time to learn what we need to learn. Today if you know React and ASP.NET Core, you're safe.

Collapse
alexandrudanpop profile image
Alexandru-Dan Pop Author

Thanks for the excellent comment! Yes popularity wise I was not comparing it to React, but to other backend ecosystems out there. It is clearly very popular, but not as talked about and shared so much like as you said Java Spring, GO or Node. It's a pitty because as you said, ASP.NET Core is really a state of the art framework.

I also like Visual Studio + Resharper, and agree it's harder to code C# on VS Code - and I think this is exactly one of the huge problems. You should not depend on VS. You should have cross-platform, free tools that make DX excellent, not depend on VS that is not cross platform (yeah I'm aware of VS for mac).

Collapse
jwp profile image
John Peters

I did some Java work 2 years ago after a 10 year hiatus. IntelliJ was good but not close to Visual Studio. Java Ides are still sick.

Collapse
kyziur_28 profile image
Krystian

If you want cross-platform IDE I would say that Rider is the best and it is way faster than VS.

Thread Thread
alexandrudanpop profile image
Alexandru-Dan Pop Author

Thanks Krystian, I did give it a try some time ago - maybe two or even more years. Will check it out again when I have some time. Would like it if VSCode could do all I need - React, TS, C#.

Collapse
theonlybeardedbeast profile image
TheOnlyBeardedBeast

In .net core you can have a multi project setup in a solution, so like a monorepo. Actually I do this combination for years now and I love it. React TS + .Net core with Code First Graphql (hotchocolatte)

Collapse
alexandrudanpop profile image
Alexandru-Dan Pop Author

Yep definitely React with TS for the FE. Yep, you are right about the multi-project solution, but I think cli-wise you are limited, and tools like Lerna for example allow you to do more.

Collapse
theonlybeardedbeast profile image
TheOnlyBeardedBeast

You are able to handle a lot of things cli wise, but for sure it is not that good experince, using the full blown visualstudio is the real powerfull stuff here, lerna and yan workspaces are much better cli wise, true.

Collapse
shaijut profile image
ShaijuT

Now its more cool after the launch of .NET 5.0 , By the way you said "This ecosystem would have great success if people would be more open and share things more". I would like to know What the community should share ? Do you want how to tutorials like , how to deploy Asp.Net Core app or How to send Email etc ?

Collapse
alexandrudanpop profile image
Alexandru-Dan Pop Author

Yep, more:

  • blogs
  • tutorials
  • libraries
Collapse
simanto_rahman profile image
Simanto Rahman

I've been using .NET for backend since .NET Core 1.1 and I agree. Once that learning curve with ASP.NET Core passes, it's a really powerful tool. Middlewares give more accessibility compared to something like NestJS. I rolled out my own set of middlewares for Identity rather than Microsoft Identity (which is an overkill for smaller projects). Proxy setups like Ocelot makes it easy to assemble complex micro servers that will ensure all your microservers are behind an authentication system. React + ASP.NET Core for FE + BE is THE perfect combo for me.

Collapse
killianfrappartdev profile image
Killian Frappart

Hello Alexandru,
Are there any ressources you would recommend to learn C# and .Net Core for a beginner ?
Thank you very much!

Collapse
alexandrudanpop profile image
Alexandru-Dan Pop Author

Start with C# first, Mosh has a nice video:

Collapse
killianfrappartdev profile image
Killian Frappart

Awesome πŸ˜‡