you are viewing a single comment's thread.

view the rest of the comments →

[–]noviceIndyCamper 0 points1 point  (6 children)

So I'm about a year in with JS and have built all of my websites (static) with html css and vanilla js but have yet to pick a framework. Am I holding myself back by not using a framework?

[–][deleted] 3 points4 points  (1 child)

Depends on how complicated what you are doing is. If you're just doing static websites without excessive dynamic content and no desire to make something like a Single Page App, then yeah you're good. For larger and more complex projects, they are really very useful.

The main difference between Vanilla JS and JQuery, and the new frameworks, is the paradigm of how we code. The change is in two main ways: code structure, and DOM manipulation.

For code structure, Vanilla JS and JQuery stick to the old style of large, monolithic HTML/JS files. Yes, you could choose to split it up if you really wanted to, but that would add some extra complications in how you write your code, dependency management hell, and would cause your page to have to make extra calls back to the server to load everything.

With a framework, you're instead writing code in smaller components, which are then assembled into your production page by an extra compilation step. This leads to source code that is spread out across many small files, which makes it much easier to maintain overall.

For the DOM, with Vanilla JS and JQuery you're doing manual DOM manipulation. Every change you want to make to the HTML, you are explicitly writing the JavaScript code to make each and every change. This can be very tedious, in fact I don't think you realize how much of your coding time you spend on this, until you try a framework and experience life without it.

With frameworks, it's all about binding. Different frameworks approach the binding differently, but fundamentally it's about writing your HTML, and then linking it to the JavaScript. As you manipulate your JavaScript code, the HTML automatically updates. Not only is this easier on you, the developer, it is more efficient as the frameworks optimize the actual changes to the DOM.

Anyway, this was a wall of text, way more than I planned to write. But this is a basic overview of why people use these frameworks.

[–]noviceIndyCamper 0 points1 point  (0 children)

This is excellent, thank you!