In this post we will try to answer very frequently asked question amongst aspiring new developers, whether to learn JavaScript or React. To answer this question, we need to first differentiate between the two.

What is JavaScript?

JavaScript is a scripting or programming language that is used to make web pages interactive and add complex features. It allows for us to make dynamic pages that interact with the user and dynamically create HTML content. With JavaScript you can:

  • Add interactive behavior to web pages
  • Make Things Dynamic

  • Add complex features on the front end of your site.

What is React JS?

React JS, a JavaScript library

React JS is a JavaScript library that is commonly used for building user interfaces based on UI components. With React, you can create dynamic single page applications and amazing user interfaces. It’s used for handling the view layer for web and mobile apps. It also allows us to create reusable UI components. With React you can:

  • Create dynamic web applications and single page applications.
  • Create apps that are fast and easy to manage.
  • Re-use UI components wherever you need.
  • Add SEO friendly features.

React JS vs JavaScript

As you can see from the above mentioned information about the two, React JS is a library of JavaScript or in other words, it is based and built off of JavaScript. With React, you can build reusable components and amazing UI’s . However you will probably be using a lot of JavaScript concepts. You may also lack some of the freedom Vanilla Js provides.

The differences:

  1. Plain JS apps start with the initial UI created on the server (as HTML) however, React apps start with a blank HTML page in which content is added dynamically.
  2. In Plain JS, functionality is up to you and you can structure your logic and code as you please. React requires you to split your app into components which contain separate pieces of UI.
  3. React updates your UI automatically based on it state unlike Plain JS where you have to manually find and update your items in the DOM
  4. With React you can create very fast Single Page Applications.

 
So what to learn, JavaScript or React ?. The short answer is that it you should first learn JavaScript and then move on to React. The long answer is well, it depends.

Why you should learn JavaScript

 

JavaScript programming

JavaScript a Scripting Language


Learning JavaScript is a must if you are a front end developer. It is used almost everywhere now and without learning it, you will have a tough time make quality web pages that keep the user hooked. There are a number of reasons why you should get started with JavaScript first instead of React:

  1. Plain JavaScript or Vanilla JS as it is commonly called is much more customizable and doesn’t have any rules about how data can be defined or how the UI can be changed meaning it is a good way for new developers to get started.
  2. Vanilla JS is much easier to learn and gives you a solid grip on programming concepts that will be used down the road.
  3. Once you have a good grip on it, you can easily switch to any framework or library like React, Vue or Angular since all these technologies are based off of JavaScript and JS concepts.
  4. React streamlines the process of creating user interfaces. However, to actually create those UIs, you need JavaScript.

 

Can I Learn React.js Without Knowing JavaScript?

Yes, although it will be quite difficult. React is a JavaScript library, so most of its core concepts are those of JS. Conditional statements, arrays, data types, loops etc. all are based off of JavaScript. Without prior experience with these essential concepts, the learning curve will be quite steep.
If you do want to learn React JS directly, prior information on some important JavaScript concepts will prove to be useful. These include basic conditional statements, DOM manipulation, functions and classes, events and methods, arrays and objects to name a few. If you have a basic understanding of the following concepts, then learning React will become much easier for you.
Knowing how variables, array functions, callbacks, scopes, and other JavaScript related concepts work will greatly speed up the pace at which you’re able to learn React or any other JavaScript framework/library.

Conclusion

If you want to be a front end developer, I would suggest getting a good grip on JavaScript and then moving on to React. React is definitely worth learning especially if you are creating complex applications that need to be maintained regularly. However, the best approach would be to get a basic understanding of the core concepts of JavaScripts and then learn React because new frameworks and libraries come and go, but the basics always stay!.