What exactly are these frameworks and how can they be helpful? Since there are a bunch of frameworks out there, which ones do you pay attention to and which ones do you ignore?
Well, that is not very helpful, is it?
If you have been following JS development even casually, you may have already heard of frameworks such as AngularJS. Here, AngularJS is a framework for dynamic web applications. In other words, when you create a web app using HTML, AngularJS lets you extend your HTML code so that you can write the application’s components using it. Therefore, using AngularJS as a framework, you find the solution to a problem — you do not need to write additional code; instead, you can reuse HTML as a template engine and express your application’s workflow using it.
The most obvious benefit of working with a JS framework is that you get a robust and reliable code base for your projects. You can build upon the framework’s code structure and extend it to suit your needs. There is hardly any need to write everything from scratch.
Another common advantage of going with a JS framework is that most of these frameworks are well documented. Furthermore, such frameworks are often under very active development. This implies that you can expect bug fixes, new features and other updates rather regularly.
Raw JS is, comparatively speaking, faster to run. While a framework can get the job done and be easy to learn, raw JS is often the “master” level of development. Many developers tend to operate purely with raw JS and then build along as they progress, so as to have better control over their projects.
Speaking of control, coding in vanilla JS means you are free from any dependency on a given framework. Opting for a lesser known JS framework means if the framework is abandoned by its developers, your project may suffer. You may have to re-build everything with a new framework or, even worse, rely on an out of date and unsupported framework.
- React serves as the base for a wide array of existing WP-related projects, including the REST API, Gutenberg and other apps based on it.
- React is maintained by Facebook and is under active development. In other words, it is not likely to be abandoned anytime soon.
- It has a big community of users and there is no shortage of learning material on the internet.
AngularJS too, in comparison to React, is a wise enough choice simply because it is backed by a large community and has a very detailed and versatile documentation.
Another alternative would be Vue.js which is lesser known but is rising in popularity every day. It is said to have a very easy learning curve even for absolute newbies. Even though the community is rather small for Vue.js, it can be used for a wide variety of projects and is surely worth a shot. It is highly performant, well documented, and has already been localized into multiple languages.
JS libraries, on the other hand, are a set of functions and classes that can be called to perform a specific task. For example, a library to show glittering text in Comic Sans (okay, bad example, but you get the idea) will do just that — show glittering text in Comic Sans. Your JS framework can call this library as and when needed to perform this given function. Thus, a JS library is a set of pre-written code that can be used to abstract and perform specific tasks within the workflow for faster development.
Going by the textbook definition, a JS library should be limited in its functionality such that it performs only a given set of specific tasks. A JS framework is a prototype that does a diverse list of related tasks. However, many big JS libraries can perform such diverse features that they are termed frameworks in their own right. YUI is a good example. This is why the definition and difference between JS libraries and frameworks is a blurry one nowadays.