Why Do We Need Javascript Frameworks in 5 Minutes
Why Do We Need Javascript Frameworks in 5 Minutes

And it may sound scary but I recommend learning framework before you learn language itself.

So what is a Javascript framework and can we build client applications without it at all. To answer this question we need to write down a list of things that a typical Javascript project need.

First we need to configure transpiler for our Javascript. Why? Because we might use some features that don't work in all browsers and we want to be sure that our code with work everywhere. Babel is the most popular solution for this problem.


Secondly we need routing. Why? Because we want to create different pages of our application. All javascript pages is actually a single index.html page and we just remove the content of the previous page and render new page. But it should work correctly with urls, dynamic url, clicking backward and forward, external urls and much more. There are for such libraries for routing if you don't want to build it from scratch which I can't recommend.


Next we need architecture of our application. We need to plan how to structure our code, split and reuse pages, logic, sharable components and so on. It's really difficult to especially if you are not experienced developer.


We also need to implement VirtualDOM and wise rendering of our Javascript. The problem with Javascript is that we need to do lots of small manipulations in every place of our code. Here we need to disable a button and there change the amount of notifications. The easiest solution is to rerender the whole application every single time when our data change. But of course it's won't be fast. This is why there is a thing which is called VirtualDOM it build a snapshot of real DOM inside Javascript and recalculates what need to be updated in real DOM after each change.


We also need state management because normally we have lots of states in Javascript. We want to share the list of product in the basket, store notifications, loading, error, success state and much more. In big application you might have thousand of state.


So here is the answer. We need javascript framework exactly because we get all things that we discussed there out of the box. Routing, transpiler, architecture of the application, VirtualDOM, state management and much more. It's not possible to maintain medium or big size application without framework at all. Or you will just build a framework first then the implement your application on the top.


Of course if you have just a page with 30 lines of javascript you don't need any framework but for anything bigger I don't recommend to working without a framework.


Most people think that when it's come to learning any language they need to really master all possible concepts of this language and practice just writing this language. And only after a lot of time when they are good with it they can learn frameworks. It's extremely popular in Javascript to solve some tasks like fibonacci numbers or palindromes. The problem is that it is not what you will do every day at work. You will with framework and you should solve problems and build things that you will do at work. Not just some random tasks. This is why I highly recommend to learn framework and build real things as soon as possible. You should learn the basics of the language but not sit on it for years. You will learn language deep over time so don't neglect learning a framework.

Also if you want to improve your programming skill I have lots of full courses regarding different web technologies.