I'm curious. In the past 2 years the market started to move to the frontend frameworks (Like Angular, React, Vue, etc.) .
Do we really need them? Is it necessary to write everything in Javascript?
Why should I have to bring buisness logic to the client side?
If I have to choose, I would use Angular, but as far as I can see, most of the companies prefer to use React. I know that React is the "new" big thing and it is super easy, to getting started with, but that jsx syntax is not my best friend.
This article give me the boost, to ask this question:
https://dev.to/iamschulz/in-defense-of-the-separation-of-concerns-24m0
Maybe I'm too conservative, but I don't think that we should use it everywhere.
BTW: It is just my opinion and I didn't say, that React/Angular are bad and never want to use it.
All of the recent trends like frontend frameworks and microservices etc, are driven by projects and companies with large teams and complex applications. There it is essential to being able to slice the app into distinct responsibilities meaningfully. If you are small and your problem space is nothing exotic, then you do not feel the urge to apply these technologies as much as they are. You can solve 80% of the problems without using JS frameworks, and there are almost zero benefits to picking one of the other. Stick to technologies, you know, and you have the most experience with it.
Apart from what has been mentioned, there is something else to take into account:
If you work alone you can use no or any framework. If you work on a bigger project, in a team, and create everything "from scratch" it will be a lot harder for a new developer to join the team as he will have to learn all your custom frameworks, APIs and way of writing code. By using a popular framework you can at least enforce some well tested coding practices which many developers already know, so they can quicker get started writing code in a new team.
I'm not personally using them in my current projects, but I've created libraries/components that they use. To simply put: They allow coders to
(I didn't use routers yet, but AFAIK they provide pages and navigation between them for web applications)
when building either small libraries, components etc. or complex applications. You can also separate the repositories for each component in your frontend like services in microservice architecture if you want. And also you can use production-ready ready to use components from a lot of sources like github. And you are correct, you shouldn't use it everywhere.
And one more thing that I experienced two weeks ago; I know how to code Vue.js and I was asked to code some tasks in a frontend developer job interview.. with Angular. And there wasn't any option to change the language to another framework. I had to code it in Angular which I never touched before. I had 2 hours to finish 5 tasks, I thought that I can't do it at first, but later I was able to finish it because their methodology and how they treat the DOM seemed to be the same. Just had to google the keywords of doing the Vue operation in Angular, and it worked. My point is, knowing one of them makes you understand the other.
It's been going on for more than a few years, but you are correct in that the topic reached mainstream attention in the last couple of years. The choice of Angular/React is a false dichotomy. A lot of big companies (as in personnel count) use Angular. It has distinct advantages in that environment. A lot of companies use React. It has distinct advantages as well.
Angular is a complete framework that is highly opinionated. There is (generally speaking) a correct way to do things in Angular. It attempts to solve structural and architectural problems at the code level. It is very good at that, and that directly plays to the requirements of large development teams.
React is a library, not a framework. React was created exclusively for the purpose of creating UI views. That is why, when you see references to React, you also see something else mentioned with it. React/Mobx, React/Redux. React could be considered an ecosystem because you can pair any number of other libraries with it (in fact, you kind of have to include other libraries with it to get the same functionality as you get from Angular).
I will point out that Vanilla JavaScript (just JavaScript) is a perfectly reasonable alternative to frameworks and libraries. I use it extensively. There are more than a few advocates of this approach as well.
https://alistapart.com/
https://blog.jeremylikness.com/blog/2019-04-09_vanilla.jsgetting-started/
https://snipcart.com/blog/learn-vanilla-javascript-before-using-js-frameworks
https://www.freecodecamp.org/news/is-vanilla-javascript-worth-learning-absolutely-c2c67140ac34/
https://javascript30.com/
When you consider using JavaScript for your project, you need to consider cost - the cost of development and the cost of reach. When you reach for a framework, you establish upfront that your product is not for everyone. You are purposely increasing the cost for entire swathes of the population, primarily costing them time, but sometimes real money, too.
Remember, nothing you send to the browser (mobile, desktop or otherwise) renders faster than HTML and CSS.
Make sure you consider the cost of JavaScript.
https://www.infoq.com/news/2019/07/javascript-cost-download-execute/
https://medium.com/@addyosmani/the-cost-of-javascript-in-2018-7d8950fbb5d4
You don't have to use them. Writing code without any frameworks is a refreshing practice once in a while. It remembers you how simple code can be, and then -if you're using frameworks or libraries in the right way- it will remind you why you started using these tools in the first place.
I find front-end libraries really helpful when it comes to lifecycle management and general structure. Without these two I would be absolutely lost, and I'd be writing code which I would not be able to maintain any longer than 24 hours.
You are 100% correct about it should not be used everywhere. That being said I have 3 reason why I am using React in my project.
I prefer to have my frontend and backend applications in separate repos. Being able to deploy one without the other has been really beneficial and allowed me to speed up code deployments.
Related to my last point, deploying and serving most of my application code from AWS s3 has been great! The amount of time dedicated to devops is has been reduce to just managing a small and simple api server. And even that could be moved to a 3rd party service. More time to code!
Working with a popular framework has allowed me to take advantage of components created by the open source community. For example, I needed a react calendar component for my application. After about an hour of research I was able to have a fully functional prototype in my application. While full integration will take much longer, leveraging the open source community has saved me countless hours.
With my experience working with both React and Angular, React is far more better than Angular. I felt Angular, quite bulky as it is a framework while React is just UI Library.
Also I have been working on mobile app with React Native which I can easily transfer skills from React.