Everyone who develops in JavaScript inevitably comes across a few frameworks/libraries, and just as inevitably uses one, then another… a third, fourth, fifth… Sounds familiar? Fortunately, the situation is not as bad as it was a few years ago, when a JavaScript framework was released every five minutes, and people ( not the framework ) couldn't help but wonder.
On the one hand, it is no coincidence that I wrote in the first sentence: with a framework / with a function library . Some people would immediately condemn me to a public lynching if I were to framework React or library Angular , and since I am trying to take care of my physical health, in this case the correct use of words also serves a kind of mandatory health-preserving purpose, in addition to accuracy. Now that the matter has been discussed, what is the difference between a library and a framework? Where is the line drawn? So far I have come across two very good formulations:
- It depends on whether you call him or he calls you. (IoC)
- If you write your code in it, it's a framework, if you drag their code into yours, it's a library.
Based on these, it can be relatively easy to narrow down which one is which. In the case of jQuery , it is clear that we use it in our own code where and when we want. Compared to Vue , where we create the Vue instance, use the specified methods, and write our code in them.
In practice, however, the lines often blur. Let's look at an example:
- The React page reads: A JavaScript library for building user interfaces
- On the Vue side: The Progressive JavaScript Framework
These are two similar things, yet one bills itself as a library, the other as a framework.
So how is it now?
We can read this much more about Vue : An incrementally adoptable ecosystem that scales between a library and a full-featured framework. Literally: yes-yes! Just as this can actually be applied to React in the same way. That's when I let it go and gave up on strictly distinguishing the two. There is no globally accepted definition, it really depends on where and how strictly we draw that particular line. But do we really need to separate the two from each other? Do we absolutely need to distinguish them on the frontend? I don't think so. In fact, an even bigger question is, do we really need frameworks at all? The latter was not a poetic question either, even if many people read the previous line very badly.
I will very briefly explain the pros and cons and explain my position.
I'll start with the cons. The main problem is that if we put knowledge of a given framework before knowledge of the language it uses. In other words, we start using frameworks without actually understanding the basics of the given language - in this case JavaScript .
From here:

Let's not jump right in here:

Of course, we can figure out how to start it, how to steer it, and take it for a spin at a hard 20km/h pace, but the whole thing will be really bumpy, and it's not life insurance.
This does not mean that we cannot use a framework without in-depth knowledge of a given language, it just means that it is not worth it. Learning both the framework itself and the given language through a framework is not the best choice. It is better to proceed with our studies in a well-defined order. HTML , CSS , a CSS framework, JavaScript at an advanced level, and if these are on solid footing, JavaScript frameworks can come.
The other downside is that once you get to know and love a framework, you may become inclined to use it for every task. Developing an infinitely simple UI component with Angular is not a rocket launch, but a Death Star launch. Choose the right tool for every task, and don't make decisions based on subjective judgment. Don't get stuck with a known framework, always learn new things, because that's how you develop and increase your own market value.
Do frameworks provide anything that we couldn't do without them? No, because they are built on the given language. We can do everything just as well without using them, and don't be afraid to code in VanillaJS , because that's how you really get to know the language.
So why are they needed, what is the extra they provide? I don't want to list everything, from development speed, community, documentation, reusability to conventions (well, I listed them anyway), but I think the real reason is quite simple:
No need to reinvent Spanish wax!
Why write something when others have already done it? And probably quite well, since thousands of developers use their codebase every day.
The existence of frameworks is unquestionable, just look at frontend job advertisements. Almost everywhere we need knowledge of Angular , React , and sometimes other frameworks. So if our goal is to get a good job, a deeper knowledge of different frameworks is a clear advantage, but let's not forget, knowledge of frameworks does not replace knowledge of the language!
