DEV Community

Mohmed Ishak
Mohmed Ishak

Posted on • Updated on

What's React.js (For Absolute Beginners)?

Alt Text

Hello. I know that you've stumbled upon the term "React" hella lot of times so I'm here to explain that to you assuming you know nothing about React.

React is a JavaScript library to build UI. All web applications have a frontend (UI/anything that you can see).

The Traditional Way to Build UI

Use HTML (for page structure), CSS (for styling) and JavaScript (for interactive behaviors).

One Major Problem

To make complex functionalities/interactive behaviors such as converting kilogram (kg) to gram (g) using JavaScript, we need to manipulate the DOM element which can be difficult and needs us to write more code which can pollute the codebase.

What Will Happen If I Use React?

You will write way less code and you don't need to manipulate the DOM directly. The whole idea of React is to provide an abstraction over the DOM so you can focus on end product without unnecessary complexity.

Any Other Cool Stuffs About React?

A whole lot.

  • Fast (thanks to virtual DOM)
  • Has super large community
  • Ease of learning (because it's not a framework or complete solution, but just a library)
  • You can write HTML inside React components using something called JSX expressions (JavaScript XML) so there is no need for a HTML file
  • etc.

Example React Code

import React from 'react';

function delete(props) {
  return (
    <div>
      <h1>Hello, world!</h1>
    </div>
  );
}

export default delete;
Enter fullscreen mode Exit fullscreen mode

Top comments (0)