Choosing a front-end framework
Today, the world of JavaScript development is overcrowded with libraries and frameworks, in front-end, mobile and full-stack.
The reason of why there so many libraries and frameworks in JavaScript is debatable. It could be because:
- They are easy to do
- JavaScript is very popular
- Learning JavaScript is somewhat easy
- The JavaScript ecosystem is very robust and complex
- Companies and people want recognition
And many, many more. From 2015 to 2017 I was a front-end developer (previously a full-stack developer). And when I entered the JavaScript ecosystem I was freaked out by all the tools, libraries and frameworks that you could use.
For our first project, deciding if we needed a framework or not was a though decision, something that should not be. We used Bootstrap and jQuery. It was a simple web application that used some plug-ins, had some form validation and data binding, that was it.
The second application was exactly that, but without using jQuery (the client did not wanted it), so we used pure vanilla JavaScript.
In our third project we used Handlebars in order to manage templates, and again some jQuery.
We learned from the previous mistakes. And in our fourth and final project, we decided that we needed the right tool for our more than repetitive tasks. Basically, what we needed was two-way data binding, templates, and something that did not conflict with jQuery (because of some plug-ins).
We evaluated around 15 frameworks and we always came to the same conclusions: it is too complex, it is not what we need, it has a weird dependency with NodeJS, it is not compatible with x, y, and z plug-in, etc.
In the end, we chose good old KnockoutJS with PagerJS. It did made some development aspects much easier, but also gave us a few headaches. In the end, I was satisfied with our choice. But the bottom line is... you probably do not need a framework or a library.
If your application has few interactions with the DOM, and uses some plug-ins, all you need is pure vanilla JS or maybe jQuery. Maybe.
If, however, your application is a complex system that requires more control, you could evaluate other options. I cannot list all frameworks and libraries in a single post, but before choosing a framework, if you need it at all, answer yourself these questions:
- Why I want and need this particular framework?
- Does it addresses the needs of my application?
- Does it addresses the requirements of the development team?
- Does the learning curve justifies using the framework?
- Will it make development easier?
- Do you feel comfortable and productive with that framework?
Why you should not use a framework:
- Because it is new
- Because everyone seems to be using it
- Because x company or project uses it
- Because it is "trending"
Chances are that your application only has some CRUD operations, form validation and charting. If that is the case you probably do not need a framework.
I find this post by Eric Eliott interesting. I would first learn the basics of pure JavaScript (ES6, closures, promises, callbacks, built-in methods, etc.) and then evaluate a framework or library.
With all the options we have today, I think VueJS, ReactJS or AngularJS are solid choices. The above post by Eliott makes it clear, you cannot go wrong with React.
I like how VueJS has a small guide in helping you decide whether if you need it at all. Angular is a hot topic, it is a full MVC front-end framework, but the fact that it has three versions, a size of 180kb (minified) and one of them depends on TypeScript kinda ruins it for me.
Backbone looks very interesting because it uses Underscore in its core, and many successful websites have used it, Ember is brutal, too. As for Knockout, I hope that it gets more updates in the future.
Good luck!