✅ Server side or Client side?
Hi, finally i get to MVC and it looks much easier then work with minmal api, so i have some questions about it. should i use views for 100% of my htmlpages? like, as i get, cuz mvc is just part of net core, instead of return View() i can use app.UseDefaultFiles(); and i thing it gonna work without any problem, is it bad tone to mix ways of rendering? also, in old project i was requesting data with fetch and rendering it like this -
2 Replies
with mvc i can do it this way
looks much easier to do what i want.
so what im asking, should i do everything using Views or use them only for things i can't do with js?
Use model when your page can't do without that data. You can also manage page content depending on that data more easily. As an example, user data in header, name and age.
Use AJAX (fetch) when you want asynchronous operations. That allows you to manage page without reloading. For instance, you could login, then say "Login successful!" to user without refreshing the page. If it fails, then you could say something is wrong, check password.
You could also try front end frameworks like Angular, React or Vue.