DEV Community

Cover image for Vanilla JS or Framework?
Adebayo Rilwan Ajibola
Adebayo Rilwan Ajibola

Posted on

Vanilla JS or Framework?

This question keep popping up in the mind of almost every front end or fullstack developers especially the startup ones.They will be like which one should i go for? vanilla js or framework? vanilla js is when you're writing pure javascript for example:
const trigger = document.querySelector('.element');
trigger.addEventListener('click', (e)=>{
/* some code here */
}
The thing is using a framework might not be the best option for a beginner, if you are just starting as a developer, starting from vanilla js will be a great one for you because when you jump straight to framework there are some things working in there you won't have the idea of how it works or the logic behind it plus you're going to find it difficult to tie your head around it.now lets highlight the advantage and disadvantage of using both..

  1. Vanilla js (advantage) js
  • The beauty of knowing vanilla js is that you can learn any web framework eg react, angular, vue, backbone and so on,just name the framework you will be able to pick up anyone of them and do something with it as quick as possible.
  • Using vanilla js for your app will put your mind at rest because your app won't depend on crazy quick changing js ecosystem.
  • Vanilla js (disadvantage)
  • The only disadvantage we have with vanilla js is the limited time we have to start writing our code from scratch.imagine before you start writing const div = document.getElementById('element'); and so on before you achieve a click event, it somehow terrible and time consuming.

js-cofee

  1. Framework (advantage)
  2. The pretty advantage of choosing a framework is that there is ease of time in doing a lot of things.
  3. It has a lot of pretty predefine functions you can use without you have to write 50 lines of js. react

angular

vue

  1. Framweork (disadvantage)
  2. Some framework is very bulky when it comes to functions with large set of powerful features and codebase e.g angular
  3. Knowing framework without you have the in depth knowledge of vanilla js might not be a good one for you because some things will be working be like magic to you.

So if you are just starting as a developer, i will advice you start from vanilla js then once you're very comfortable with vanillaJs, pick up any framework of your choice and learn it with ease.

if you have any addition or substraction do not hesitate to share them in the comment box below...
Thanks for reading...

Top comments (0)