3 ms·
Server-side rendering is absolutely fine. The only caveat I would add is that if you want to change some functionality to a client-side JavaScript app later the
by jsingleton 10y ago
Server-side rendering is absolutely fine. The only caveat I would add is that if you want to change some functionality to a client-side JavaScript app later then having dynamically generated HTML will make this harder. For example, if you want to make it work offline in the future then you will probably have to rewrite the presentation layer.
Razor views in ASP.NET Core are really nice (disclaimer, I wrote a book on this so I'm obviously biased). However, if you are making a Single Page App then you will need to stick to HTTP APIs (returning JSON, not HTML). The controllers in Core can easily do both now that MVC 6 and Web API 2 are merged and the same thing.
The only exception to this is for an initial rendering of your app server-side, so that the browser gets populated HTML on the first load and there is something to see immediately. For example, using ReactJS.NET you can load the same model into your Razor view that you return from your API and pre-render it using view helpers.
If you're interested then I wrote more about this today: https://unop.uk/react-and-asp-net-core/ https://unop.uk/react-and-asp-net-core/
P.S. Has this whole thread been hidden or flagged?