Working with .Net Core & React - what I've learned
Tags: react, dotnet, csharp, typescript
Published: 2020-10-09 11:27:13

---
title: Working with .Net Core & React - what I've learned
description: Learn about .Net Core & React and my thoughts on both ecosystems
canonical_url: https://blog.alexandrudanpop.dev/posts/working-with-net-core-react-what-i-ve-learned-ge6/
---

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](https://insights.stackoverflow.com/survey/2020#technology-most-loved-dreaded-and-wanted-web-frameworks)

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
{%  twitter 1299752196356136962 %}
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)
4. Things move much faster - and it's harder to stay up to date
5. 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 😉
{% post https://dev.to/alexandrudanpop/why-react-projects-still-use-redux-in-2020-395p %}

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?