question

johnjohn-0472 avatar image
0 Votes"
johnjohn-0472 asked sreejukg answered

Can we use React.js with ASP.NET Core MVC, or it is only suitable with ASP.NET Core Web APIs?

I want to learn React.js, but most of the tutorials show how to integrate ASP.NET Core Web APIs with React.js, while I did not find any tutorial for using React.js with ASP.NET Core MVC. Any advice? Can I assume that React.js works only with ASP.NET Core Web APIs, where React.js is used to consume the JSON returned from the API?

dotnet-aspnet-core-mvc
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

The premise of your question is incorrect. There are a lot of examples where React is integrated into an existing application including MVC. This is a main selling point of React and explained on the official React site. React can be added to a page or new application feature allowing migration to occur over time.

Your observation is correct though. React and MVC solve the same problem of rendering dynamic HTML through data binding. React does this in the browser and MVC on a web server. If you are only reading React getting started tutorials then, of course, you'll see a lot of calls to JSON files or REST APIs because that's how React fundamentally works. The same idea applies to MVC. You do see a lot of MVC getting started tutorials that implement React because MVC handles the data binding.

It's important to understand the problem a framework solves so that you are not duplicating your efforts.


0 Votes 0 ·

1 Answer

sreejukg avatar image
0 Votes"
sreejukg answered

React is a front end framework and it fetches data from backend systems using Rest Services. So React and WebAPI works very good, but at the same moment, it works well with MVC.

There is a ReactJS implementation by the React team for MVC and other .Net implmentations. Refer

https://reactjs.net/

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.