Once it was easy, you had plain javascript, and you had jQuery.
Nowadays it’s like trying to choose one single item in a supermarket, too many choice
I did search a bit, and found some interesting articles (also on SitePoint), but if someone could advise me I would be really grateful: what framework would you use today if you could choose freely?
I don’t want to install anything, just use it in a website (like jQuery).
Please let me know if you need more info to be able to give me an advice.
Is it just an actual (content-oriented) website, where you’re wanting to add a few bells and whistles? Or you’re talking about an application, where you’re going to be providing more complex functionality, fetching data in the background and re-rendering sections of the UI etc?
Hmmm, OK… so probably my recommendation would be either Backbone or Knockout. I’m slightly biased here, as these are the two frameworks/libraries that I’ve had most exposure to, but I’ll explain my reasoning:
Small learning curve: Backbone is relatively simple to get your head around, and sticks close to the traditional way of working with the DOM. Knockout is maybe slightly more complex due to using two-way data bindings and making you declare those bindings directly in the HTML.
No need for additional tooling: Both will run by including the relevant scripts in your page. There’s no need for additional build/compile steps, or setting up task runners etc if you’d prefer not to.
Work fine with or without jQuery: Both will happily co-exist with/use jQuery out of the box, although Knockout doesn’t need it to function and Backbone can be configured to work without it if you’d prefer to use native DOM methods.
Good support/community: As both have been around for a long time now, there is good documentation, plenty of articles and tutorials available, and many plugins/snippets for doing pretty much anything you might want.
In terms of pros/cons for choosing between them, Knockout is really just a view library and leaves you on your own in terms of application structure. Backbone, on the other hand, provides other components like models, collections, and routers.
As time goes by, I think this will bind your hands more than anything.
In addition to Backbone or Knockout, Angular 1.x works without any extra steps, but Angular 2 will require some building and most everything I’ve seen has been in TypeScript. You can do React, but you can’t use the JSX everything is built in. I don’t think Vue.js requires anything extra. Other than that, don’t forget about TodoMVC to kinda give you an idea of what’s out there and some code samples.
Oh well that’s fine then, you’re open to just about anything. I think most just need the build step on your local machine then you push the compiled version to the server. I can’t think of any off hand that don’t work this way, Compiling per request would greatly affect performance.
Good choice, React’s tiny API will let you be productive really quickly. Backbone is still an option if you have a handful of views you want to make more dynamic, but React’s rendering is much smarter and simpler to reason about.
Don’t
Thanks for the article. Now I’m doubting again though. It seems React only takes care of the UI? So for the rest (communication with the server) I should use something else? It would be a pity if I had to use jQuery just for the Ajax part?
Maybe I might as well look into Ember? Or would that be overkill?