1

New to ASP.NET Core, react, jsx and tsx. That being said, there are two different paths one can take to set up react on ASP.NET Core that I've found:

https://reactjs.net/getting-started/aspnetcore.html

and

yo aspnetcore-spa - https://blogs.msdn.microsoft.com/webdev/2017/02/14/building-single-page-applications-on-asp-net-core-with-javascriptservices/

Via the first method, I'm asked to install the React.AspNet NuGet package, and to add entries into the middleware in the startup.cs file.

Via the second method, there is no such NuGet package and don't appear to be such changes to the middleware.

I think that in the first method, the middleware is JITting the .jsx to .js on the fly. And I believe that in the second method, it's doing transpilation in webpack with a ts loader.

Is my understanding correct? If so, can someone help me understand the pros and cons to each of the above methods of utilizing React in an ASP.NET Core application, as well as the implications of whether one will be leveraging .tsx, .jsx, or only .js files?

Thanks!

1 Answer 1

1

No, ReactJs.net is if you want that your React code run on server (if you want SEO friendly website), and it is not required, but if you want SEO than I will user library. I used it a lot in my latest projects.

I think it is great project and deservers more attention from ASP.NET community. React is great as view layer library, but problem I had is that in my current company we are on Microsoft stack (ASP.NET). ReactJS.Net was te thing I needed. I can now have same React components that will render on server and that will render on client. Imagine how much less work now it is requried. Before we used ASP.NET MVC Razor for initial , SEO friendly render, and later for ajax (that give as JSON) we used handlebars, Mustache or similar library and had a lot of code duplication written in C# and Javascript that do same thing.

Sign up to request clarification or add additional context in comments.

1 Comment

Hi Vlado, this may have been true in the past (not sure) but at this point, the above solution that does not leverage ReactJs.Net seems to also provide server side rendering according to this: blogs.msdn.microsoft.com/webdev/2017/02/14/… If you’re using the Angular or React+Redux template, then you will have server-side prerendering. This makes your application’s initial UI appear much more quickly, because users don’t have to wait for their browser to download, evaluate, and execute large...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.