So, can you learn React without JavaScript? It’s a fair question to ask. When you first start learning how to code, it can feel like a race with yourself to get to the point where you can code anything like a god.
So is JavaScript Necessary To Learn React? Well, technically no. You can start learning React without having a strong foundation in JavaScript. However, it is going to make the learning process a lot harder and a lot slower.
In this article, I am going to explain why you could learn React Without JavaScript, but why you will ultimately learn faster by gaining a strong foundation in JavaScript.
So without further ado, let’s dive into it.
1. Most of React Is Actually Pure JavaScript
The first reason you should learn JavaScript before React is that when you start building more complex applications, you’ll find that you are actually writing a considerable amount of vanilla JavaScript.
Trust me, it is difficult enough to learn JavaScript on its own so trying to mix in React as a second element to understand is a bad idea. It’s like trying to learn two programming languages at once. Master JavaScript first and you will be a considerably better React developer. While you are creating apps you will be frequently be leveraging your pre-existing JavaScript knowledge to figure out how to do things.
2. React Forces You To Do Things A Certain Way
However, since React is a library to help you structure your projects, you need to do things in a specific way. This can feel very restricting when working with React. Ultimately, if you have tried building complex projects without React, you will understand that these restrictions are actually for your benefit.
In ReactHooks, it might feel annoying to wrap a lot of your code in useEffects or need to utilize useState and restrict how you can write code. If you have written vanilla JavaScript without React, you will realize it helps keep your code clean and standardized throughout the project.
If you don’t know how to build projects with JavaScript, these standardized ways of doing things seem more like a burden than a benefit.
When you learn JavaScript, you are actually learning a lot about React. React is really just a library to make building web apps easier to do. If you understand a lot of JavaScript, you will understand React.
3. Reactjs is not easy to learn, Until You Know JavaScript
When I first started learning React 4 years ago I was very confused with how it worked. It took a lot for me to wrap my head around the framework and I never really made a lot of progress. After built a few projects, learning React became a breeze.
It is easy to learn Reactjs if you know javascript. If you don’t JavaScript, it is actually much more challenging to learn reactjs.
Ultimately, you will learn a lot more and a lot faster if you start with learning JavaScript and master it. The more JavaScript you know before starting React the better.
You can easily get the gist of React in a day if you know JavaScript well.
Don’t get me wrong, you can learn React as you learn Javascript, it’s not necessary to learn JavaScript first. However, you’re going to have a tougher time and it will take you much longer.
4. You won’t know what’s React and what’s JavaScript
Finally, what makes it so hard to learn React without knowing JavaScript is that you won’t know what code is an aspect of React, and what is pure vanilla JavaScript.
Learning React and JavaScript at the same time is just going to confuse you further and make it harder to distinguish which is which.
React library components and JavaScript are closely coupled when working with React projects. If you don’t have a solid understanding of JavaScript, you won’t know what part of the code is built-in JavaScript functions and what part of the code is the React library.
In addition to this, you may confuse the style of writing JavaScript and writing React. Making you think the two are synonymous. This obviously isn’t the case and can make the process of learning new frameworks difficult in the future since they require a different way of thinking.
For instance, writing apps in React, Angular, and Vue can all look very different.
Wrapping up
So that’s pretty much it. Why you shouldn’t learn React without learning JavaScript. While not necessary, mastering JavaScript will ultimately make learning React a breeze.
You will be able to better distinguish which parts of your app are pure JavaScript and which are React, understand what’s happening in React under the hood, and ultimately learn much faster.
If you are new to JavaScript and want to learn quickly, check out these courses.
If you are new to web development and want a list of high-quality free sources, check out this compiled list.
As always, happy coding!