Introduction to ReactJS
Tags: webdev, beginners, react, tutorial
Published: 2022-09-07 03:58:42


## Introduction to ReactJS

![Photo by [Lautaro Andreani](https://unsplash.com/es/@lautaroandreani?utm_source=medium&utm_medium=referral) on [Unsplash](https://unsplash.com?utm_source=medium&utm_medium=referral)](https://cdn-images-1.medium.com/max/9030/0*6mQ9Nmy9xyd4ygZW)

## What is React?

React is a **Declarative, Flexible, and Component-based JavaScript library** for building user interfaces. React makes creating interactive UI’s simpler. It helps you to break down complex apps into smaller, easier-to-maintain chunks. Declarative views improve the predictability and debuggability of the code.

## First Code:

The very famous “Hello World” code can be written in the following way in React:

![](https://cdn-images-1.medium.com/max/2264/0*uLxKD2DZEo2T5aXl.png)

## Reasons to learn React:

* React is a declarative, efficient, and flexible JavaScript library for building user interfaces.

* React.js is an open-source, component-based front-end library responsible only for the view layer of the application.

* It is an MVC architecture-based library that plays the role of “C” which means control.

React uses a declarative paradigm that makes it easier to reason about your application and aims to be both efficient and flexible. It designs simple views for each state in your application, and React will efficiently update and render just the right component when your data changes. The declarative view makes your code more predictable and easier to debug.

## Features of React.js:

There are unique features available on React because it is widely popular and growing fast.

* **Use JSX:** It is faster than normal JavaScript as it performs optimizations while translating to regular JavaScript. It makes it easier for us to create templates.

* **Virtual DOM:** Virtual DOM exists which is like a lightweight copy of the actual DOM. So for every object that exists in the original DOM, there is an object for that in React Virtual DOM. It is exactly the same, but it does not have the power to directly change the layout of the document. Manipulating DOM is slow, but manipulating Virtual DOM is fast as nothing gets drawn on the screen.

* **React DOM:** ReactDOM is a package that provides DOM specific methods that can be used at the top level of a web app to enable an efficient way of managing DOM elements of the web page. ReactDOM provides the developers with an API containing the following methods and a few more.

* render()

* findDOMNode()

* unmountComponentAtNode()

* hydrate()

* createPortal()

* **One-way Data Binding:** This feature gives you better control over your application. Component: A Component is one of the core building blocks of React. In other words, we can say that every application you will develop in React will be made up of pieces called components. Components make the task of building UIs much easier. You can see a UI broken down into multiple individual pieces called components and work on them independently and merge them all into a parent component which will be your final UI.

* **Performance:** React.js use JSX, which is faster compared to normal JavaScript and HTML. Virtual DOM is a less time taking procedure to update web page content.