locked
Frontend frameworks for MVC. RRS feed

  • Question

  • User1153554953 posted

    Hello Devs!

    I am new to .net core mvc so I am looking to learn some frontend framework. I noticed that Angular is very famous among .NET community but I was a bit hesitant about learning some separate language solely for frontend. I learned that Google is also going to end the support for Angular in 2021 plus I am not comfortable with Javascript as well so I thought it would be nice to learn .NET's very own framework i.e Blazor, now I have started learning it from Blazor Course - Use ASP.NET Core to Build Full-Stack C# Web Apps - YouTube , It's a 7 hours long video made on Blazor but I have some questions in my mind now which are as follows:

    Q1. Before learning Blazor I assumed that frontend framework is something that you use in your code, e.g if I am building an MVC app then in that project I may install some NUGET package or something similar to use the framework (like we do when using bootstrap in MVC) but in Blazor, you have a completely separate type of project for Blazor, means that there are no MVC related things in that which I don't really like. Is it exactly what I am thinking or is there any way to use Blazor with MVC?

    Q2. What are the best practices to use Blazor? Have you any experience with it using MVC? Is it a normal practice? Do you prefer using Blazor with MVC?

    Q3. If I learn Blazor, do I need to learn Bootstrap separately or Blazor will serve the purpose an will cover Bootstrap's functionality as well?

    Q4. Where do you see Blazor in future? Is it worth time spending on Blazor?

    Q5. What do you think about Blazor Vs. JS Frameworks like React,Vue etc? I know there are many topics available on internet but I am asking about your opinion on this.

    Q6. Am I taking Blazor wrong? Is it just a separate type of framework used to make simple good-looking web apps? Is it not made really as a frontend framework to use with complex and enterprise level applications?

    Wednesday, September 23, 2020 12:06 PM

Answers

  • User475983607 posted

    It's confusing for me that whether or not should I learn some frontend framework. As you mentioned that Blazor and MVC are two separate things and its not normal to mix them up so my question is same, how can one deal with frontends in MVC

    MVC is a server side framework where dynamic HTML is created on the server and returned to the browser.   Frontend frameworks refer to application that run in the browser to generate dynamic HTML.

    MVC server side rendering with a frontend framework is usually called a partial page refresh.   This technique was popular before frameworks like Angular, React, Vue etc. This programming pattern uses an AJAX call to get a partial HTML response from the server.   A JavaScript/jQuery application replaces a section of the DOM with the partial HTML response.  

    I believe a frontend framework can do the same partial refresh but typically frontend frameworks transfer data to generate dynamic HTML.

    Keep in mind, MVC has support partial page refreshes for a long time.  MVC come with built in tools like the Ajax.BeginForm and Ajax.ActionLink.

    https://docs.microsoft.com/en-us/dotnet/api/system.web.mvc.ajax.ajaxextensions.actionlink?view=aspnet-mvc-5.2

    https://docs.microsoft.com/en-us/dotnet/api/system.web.mvc.ajax.ajaxextensions.beginform?view=aspnet-mvc-5.2

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, September 23, 2020 2:01 PM
  • User-474980206 posted

    Blazor is used to build a single page application (SPA) or now more common PWA. This is more of an application hosted by the browser, which makes webapi calls to a server. They are often hosted by a static web site. So typically you would have a static frontend project and a webapi project. These are replacements for mobile or desktop apps

    not all sites make sense to be a SPA/PWA, especially if it’s important they be crawled by search engines. Take this site for instance, it’s  all server side except the for the JavaScript library used to edit the post. Its import for this site to be crawled by search engines. While a SPA for this site might be handy as an additional feature you would still need the website. This is a common case, with SPA apps is you still need to write the website version. 

    Bootstrap is a css framework. Typically you will need a CSS framework no matter the type of web application. Angular, react, vue, MVC are all html renders, you still need to learn html and css.

    Blazor is also a WASM application. A WASM app runs in a sandbox that does not have file, network or dom access. It must call JavaScript to do this. Blazor has a JavaScript library to allow network access and dom updates. But until a blazor wrapper is written for every JavaScript/browser feature you need, you still may be writing some JavaScript.

    Note: a new feature of SPA frameworks is server side prerender, so crawlers can crawl the site. Again, take this site, it’s a good candidate for nextjs, the site could be written in react, but server hosted for crawling support.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, September 23, 2020 2:51 PM
  • User-821857111 posted

    Don't you think that it will be wrong then to call Blazor as frontend framework then? I dont get the fact then why people are comparing Blazor with frontend frameworks.
    Blazor is a front end framework. It works in a different way to the better known alternative front end frameworks such as Angular, React and VueJS. But they are all front end frameworks.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, September 24, 2020 9:26 AM

All replies

  • User475983607 posted

    Q1. Before learning Blazor I assumed that frontend framework is something that you use in your code, e.g if I am building an MVC app then in that project I may install some NUGET package or something similar to use the framework (like we do when using bootstrap in MVC) but in Blazor, you have a completely separate type of project for Blazor, means that there are no MVC related things in that which I don't really like. Is it exactly what I am thinking or is there any way to use Blazor with MVC?

    Pick one or the other Blazor or MVC.

    Q2. What are the best practices to use Blazor? Have you any experience with it using MVC? Is it a normal practice? Do you prefer using Blazor with MVC?

    No.  It is not normal to mix Blazor and MVC.  However, you might have an MVC style controller for authentication only.

    Q3. If I learn Blazor, do I need to learn Bootstrap separately or Blazor will serve the purpose an will cover Bootstrap's functionality as well?

    Learn bootstrap if you are using Bootstrap

    Q4. Where do you see Blazor in future? Is it worth time spending on Blazor?

    No one can see into the future.  IMHO, learning frameworks makes for a more rounded developer.   Your learning path is up to you.

    Q5. What do you think about Blazor Vs. JS Frameworks like React,Vue etc? I know there are many topics available on internet but I am asking about your opinion on this.

    JS frameworks are far more mature than Blazor.  There are more resources at the present for React, Angular, Vue, etc...

    Q6. Am I taking Blazor wrong? Is it just a separate type of framework used to make simple good-looking web apps? Is it not made really as a frontend framework to use with complex and enterprise level applications?

    Blazor is a frontend framework.  An enterprise application can include Blazor but typically will have a much wider range of technology and services.  

    Wednesday, September 23, 2020 12:22 PM
  • User1153554953 posted

    Pick one or the other Blazor or MVC.

    Than how can I deal with frontends in MVC? Actually I often look for jobs and they often mention some frontend framework with ASP.NET Core for their requirements. So I am thinking that if me having only MVC skills isn't sufficient for me.

    It's confusing for me that whether or not should I learn some frontend framework. As you mentioned that Blazor and MVC are two separate things and its not normal to mix them up so my question is same, how can one deal with frontends in MVC

    Wednesday, September 23, 2020 1:27 PM
  • User-821857111 posted

    I often look for jobs and they often mention some frontend framework with ASP.NET Core for their requirements.
    That should be your starting point if you are looking to improve your market value. Look at the frontend frameworks that are most commonly mentioned and learn how to use them. 

    Wednesday, September 23, 2020 1:42 PM
  • User1153554953 posted

    najum98

    I often look for jobs and they often mention some frontend framework with ASP.NET Core for their requirements.

    That should be your starting point if you are looking to improve your market value. Look at the frontend frameworks that are most commonly mentioned and learn how to use them. 

    Yeah, but I cant learn different frameworks. Most of them are JS ones that's why I asked if Blazor is a replacement for them so I should go for Blazor so that there is no language transition in it and I can deal frontend with C# too. But someone said earlier that this isn't the case. Confused

    Wednesday, September 23, 2020 1:47 PM
  • User475983607 posted

    It's confusing for me that whether or not should I learn some frontend framework. As you mentioned that Blazor and MVC are two separate things and its not normal to mix them up so my question is same, how can one deal with frontends in MVC

    MVC is a server side framework where dynamic HTML is created on the server and returned to the browser.   Frontend frameworks refer to application that run in the browser to generate dynamic HTML.

    MVC server side rendering with a frontend framework is usually called a partial page refresh.   This technique was popular before frameworks like Angular, React, Vue etc. This programming pattern uses an AJAX call to get a partial HTML response from the server.   A JavaScript/jQuery application replaces a section of the DOM with the partial HTML response.  

    I believe a frontend framework can do the same partial refresh but typically frontend frameworks transfer data to generate dynamic HTML.

    Keep in mind, MVC has support partial page refreshes for a long time.  MVC come with built in tools like the Ajax.BeginForm and Ajax.ActionLink.

    https://docs.microsoft.com/en-us/dotnet/api/system.web.mvc.ajax.ajaxextensions.actionlink?view=aspnet-mvc-5.2

    https://docs.microsoft.com/en-us/dotnet/api/system.web.mvc.ajax.ajaxextensions.beginform?view=aspnet-mvc-5.2

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, September 23, 2020 2:01 PM
  • User-474980206 posted

    Blazor is used to build a single page application (SPA) or now more common PWA. This is more of an application hosted by the browser, which makes webapi calls to a server. They are often hosted by a static web site. So typically you would have a static frontend project and a webapi project. These are replacements for mobile or desktop apps

    not all sites make sense to be a SPA/PWA, especially if it’s important they be crawled by search engines. Take this site for instance, it’s  all server side except the for the JavaScript library used to edit the post. Its import for this site to be crawled by search engines. While a SPA for this site might be handy as an additional feature you would still need the website. This is a common case, with SPA apps is you still need to write the website version. 

    Bootstrap is a css framework. Typically you will need a CSS framework no matter the type of web application. Angular, react, vue, MVC are all html renders, you still need to learn html and css.

    Blazor is also a WASM application. A WASM app runs in a sandbox that does not have file, network or dom access. It must call JavaScript to do this. Blazor has a JavaScript library to allow network access and dom updates. But until a blazor wrapper is written for every JavaScript/browser feature you need, you still may be writing some JavaScript.

    Note: a new feature of SPA frameworks is server side prerender, so crawlers can crawl the site. Again, take this site, it’s a good candidate for nextjs, the site could be written in react, but server hosted for crawling support.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, September 23, 2020 2:51 PM
  • User1153554953 posted

    Blazor is used to build a single page application (SPA) or now more common PWA. This is more of an application hosted by the browser, which makes webapi calls to a server. They are often hosted by a static web site. So typically you would have a static frontend project and a webapi project. These are replacements for mobile or desktop apps

    not all sites make sense to be a SPA/PWA, especially if it’s important they be crawled by search engines. Take this site for instance, it’s  all server side except the for the JavaScript library used to edit the post. Its import for this site to be crawled by search engines. While a SPA for this site might be handy as an additional feature you would still need the website. This is a common case, with SPA apps is you still need to write the website version. 

    Bootstrap is a css framework. Typically you will need a CSS framework no matter the type of web application. Angular, react, vue, MVC are all html renders, you still need to learn html and css.

    Blazor is also a WASM application. A WASM app runs in a sandbox that does not have file, network or dom access. It must call JavaScript to do this. Blazor has a JavaScript library to allow network access and dom updates. But until a blazor wrapper is written for every JavaScript/browser feature you need, you still may be writing some JavaScript.

    Note: a new feature of SPA frameworks is server side prerender, so crawlers can crawl the site. Again, take this site, it’s a good candidate for nextjs, the site could be written in react, but server hosted for crawling support.

    Oh thats some informative stuff. Don't you think that it will be wrong then to call Blazor as frontend framework then? I dont get the fact then why people are comparing Blazor with frontend frameworks.

    Bruce, can you suggest me some framework that I should learn for frontend? Angular is soon going to end. Should I then go for ReactJS or VueJS?

    Wednesday, September 23, 2020 4:17 PM
  • User1153554953 posted

    I believe a frontend framework can do the same partial refresh but typically frontend frameworks transfer data to generate dynamic HTML.

    Keep in mind, MVC has support partial page refreshes for a long time.  MVC come with built in tools like the Ajax.BeginForm and Ajax.ActionLink.

    So do you mean to say that there is no need to learn a separate frontend framework if a person is using MVC because it already can do what a frontend framework can do. Right?

    Wednesday, September 23, 2020 4:20 PM
  • User475983607 posted

    najum98

    So do you mean to say that there is no need to learn a separate frontend framework if a person is using MVC because it already can do what a frontend framework can do. Right?

    Huh? No!  Those are your thoughts and assumptions.   

    I feel a well rounded developer takes the time to try different frameworks as each framework has pros and cons.  If you only know MVC then everything looks like an MVC application. 

    Wednesday, September 23, 2020 6:12 PM
  • User1153554953 posted

    najum98

    So do you mean to say that there is no need to learn a separate frontend framework if a person is using MVC because it already can do what a frontend framework can do. Right?

    Huh? No!  Those are your thoughts and assumptions.   

    I feel a well rounded developer takes the time to try different frameworks as each framework has pros and cons.  If you only know MVC then everything looks like an MVC application. 

    Ah Sorry, I misunderstood your point. Can you suggest me some frontend framework to learn? Angular is going to end soon and Blazor I guess isnt a frontend framework so what framework should be good for me to learn with MVC?

    Thursday, September 24, 2020 5:16 AM
  • User-821857111 posted

    Don't you think that it will be wrong then to call Blazor as frontend framework then? I dont get the fact then why people are comparing Blazor with frontend frameworks.
    Blazor is a front end framework. It works in a different way to the better known alternative front end frameworks such as Angular, React and VueJS. But they are all front end frameworks.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, September 24, 2020 9:26 AM
  • User1153554953 posted

    Blazor is a front end framework.

    If Blazor is a frontend framework than why can't it be used with MVC as .NET developers use Angular for MVC? Why isnt a normal practice to use Blazor as a frontend for MVC to design its UI? Which framework can I go for than if not Blazor?

    Thursday, September 24, 2020 9:53 AM
  • User1153554953 posted

    If Blazor is a frontend framework than why can't it be used with MVC as .NET developers use Angular for MVC? Why isnt a normal practice to use Blazor as a frontend for MVC to design its UI? Which framework can I go for than if not Blazor?

    Actually my main purpose is to know how can I become a well rounded developer with ASP.NET Core MVC, I want to be able to develop good  looking frontends along with strong MVC background. But it seems as if Blazor is the wrong choice for this purpose. Isn't it?

    Thursday, September 24, 2020 9:59 AM
  • User-821857111 posted

    If Blazor is a frontend framework than why can't it be used with MVC as .NET developers use Angular for MVC?
    Because Blazor works in a different way.

    Thursday, September 24, 2020 11:52 AM
  • User475983607 posted

    najum98

    If Blazor is a frontend framework than why can't it be used with MVC as .NET developers use Angular for MVC?

    Technically MVC controllers can be used with Blazor and Angualr.  The MVC Actions return JSON rather than Views (HTML).  This type of approach is used for a single tier application where the client is always a browser and services are secured using cookie authentication.  This is not an enterprise application mentioned above.

    najum98

    Why isnt a normal practice to use Blazor as a frontend for MVC to design its UI?

    Blazor and MVC are UI frameworks.  Only one UI framework is needed in a web application.  Blazor binds data in the browser.  MVC binds data in View on the server.  You are an MVC developer, right?  Or are you new to MVC?

    najum98

    Which framework can I go for than if not Blazor?

    We are not your guidance counselor.  You'll need to figure what to learn on your own.   I like React.  

    Keep in mind, you could have been through a Blazor and Angular tutorial in the time you've spend on these forums.  

    Thursday, September 24, 2020 12:15 PM