Why You Should Learn React

Employers love it, and you should too.

Nithil Krishnaraj
TechTalkers
4 min readOct 6, 2020

--

React.js logo (Picture Credit: React.js)

Since its launch in 2013, React has rapidly gained popularity in 7 short years. In a survey conducted by Stack Overflow, React.js was the second-favorite web framework, right behind jQuery. With some intermediate JavaScript knowledge, learning React should be fairly easy, and learning it will definitely boost your developer skillset.

Some React Code (Picture Credit: Nithil Krishnaraj / TechTalkers)

What Exactly is React?

Developed by Facebook in 2013, React is a component-based JavaScript library that simplifies the building of dynamic UIs (user interfaces). It allows us to create reusable components, making it fast and efficient. Instead of changing the whole page, it only changes certain parts of the page where data has been updated, making it faster to load and better optimized.

Why Should I Learn React?

I ❤ React.JS Community (Picture Credit: Hacker Noon)

Community

Since it’s developed by Facebook, React.js is extremely popular, and naturally, that means there’s going to be a big community to help developers. It’s open-source, and unlike other open-source projects, React doesn’t change and/or depreciate elements that often, making it easier to work with it throughout the future. Since it’s open-source, it’s open to contributors, so you can contribute to the project as well.

Some code using React components (Picture Credit: Hacker Noon)

Reusable Components

This feature is one of the most compelling reasons to learn React. In React, you can make your own custom components, such as a navbar, and reuse them whenever you want. You only have to create one component to use infinitely in your projects. With this, you can also create custom properties for your component. This makes writing code so much more efficient compared to regular HTML, in which you have to write the same component for each page, and also improves readability, as you don’t have many lines of code on one page. Like regular HTML, you can also assign properties (props) to your components, further increasing the usefulness of the feature. As always, if you don’t want to build your own custom components, there are plenty of libraries for that, such as React Bootstrap, Material UI, and so much more.

Virtual DOM

Virtual DOM is such a great feature on React, and it is a huge reason for why I’m creating most of my projects in React.

To know what the Virtual DOM does, you will need to understand what the HTML DOM is. DOM stands for Document Object Model and is essentially the structure of the page.
It includes the <!DOCTYPE> tag, the <html> tag, etc. The DOM allows other scripts to dynamically access, update, and change the style of an HTML file. For example, to access a certain element on the DOM in JavaScript, your code will look like this:

The problem with the regular DOM is that it’s slow. It has to update the entire DOM every time a change occurs, therefore contributing to the slowness of the page. For more information, check out the Mozilla Developer Docs.

DOM Structure Tree (Picture Credit: W3Schools)

To fix this, Facebook engineered something called the Virtual DOM. The Virtual DOM is a faster version of the regular HTML DOM. It saves a state of the page, then updates the part that changes without having to refresh the whole page. This is why React is so fast and great for dynamic pages.

JSX Code in React (Picture Credit: Hacker Noon)

JSX

React uses JSX, or JavaScript XML, to create components instead of regular HTML. You can use JSX to create UI elements in React, using simple code that resembles HTML without having to use any extra methods like createElement() or appendChild(). It automatically compiles into JavaScript. Of course, it isn’t necessary to use JSX with React, but it’s helpful in terms of readability and overall simplicity. It makes learning React a whole lot easier, especially if you have prior experience with HTML.

React is an extremely fast-growing language, and it’s pretty evident why. It has a fairly steep learning curve, and many popular sites, such as CNN, Fox News, BBC, Cloudflare, Atlassian, and more run on React. Of course, Facebook is also run on React. Naturally, like any other library, React isn’t for everyone, and if you want to stick to regular HTML, CSS, and JavaScript, that’s completely fine. I personally use React extensively, and I’m currently working on converting my static HTML site to React. If you want your website to have faster loading times, simpler and more structured code, and no static HTML, you should learn React.js.

--

--

Nithil Krishnaraj
TechTalkers

Co-founder and Writer of TechTalkers. Learning about technology and photography are my passions!