Most Important Things You Need to Know About React

Lahaduzzaman Lahad
4 min readMay 7, 2021

React is the most popular front-end JavaScript library in the field of web development. It is used by large, established companies and newly-minted startups alike (Netflix, Airbnb, Instagram, New York Times, and many others). React brings many advantages to the table, making it a better choice than other frameworks like Angular.js.

Library:

Library means a collection of codes that can be reused while building a web app and UI. Similarly React is also a collection of Vanilla JavaScript codes. We can simply use those to build Mobile applications, Desktop applications & Websites.

Features of React:

JSX(JavaScript Syntax Extension):

JSX is a syntax extension to JavaScript. It is used with React to describe what the user interface should look like. By using JSX, we can write HTML structures in the same file that contains JavaScript code. This makes the code easier to understand and debug.

The above code shows how JSX is implemented in React. It is neither a string nor HTML. Instead, it embeds HTML into JavaScript code.

Virtual DOM:

Virtual DOM is a programming concept, where the representation of a UI is kept in memory with real DOM. Link a library with real DOM such as a reactDOM.It has power, properties, method same as DOM. VDOM statement looks like a tree.

Components:

The component is a collection of data and properties. The thing which is similar in look, different in data is a component. React is all about components. It increases the re-useability of code. There are two types of components in React:

  • Functional Components: These components have no state of their own and only contain a render method.
  • Class Components: These components can hold and manage their state and have a separate render method for returning JSX on the screen.

Props:

Props are short for properties. It is a React built-in object which stores the value of a tag attribute and works similar to the HTML attributes. It provides a way to pass data from one component to other components in the same way as arguments are passed in a function.

React Hooks:

React Hooks allows you to use state and other React features without writing a class. Hooks are the functions which “hook into” React state and lifecycle features from function components. It does not work inside classes.

If you write a function component, and then you want to add some state to it, previously you do this by converting it to a class. But, now you can do it by using a Hook inside the existing function component.

Babel:

Babel is a Javascript compiler and used in react application to compile JS code. Actually, Babel converts the JSX to pure HTML and Javascript form.

Styling in React:

Most of the time, we use plain CSS to give styling to our application. But in React mostly developers use the Component library for user-friendly styling. There are many component libraries available to use but the most popular one in React is Material UI. The popular utility class library is React-Bootstrap, Tailwind CSS. Being a developer you will encounter both of these. So it’s good to be familiar with both types of libraries.

React Performance:

React is known to be a great performer for user friendly. This feature makes it much better than other frameworks. The reason behind this it manages a virtual DOM. The DOM is a cross-platform and programming API that deals with HTML, XML, or XHTML. The DOM exists entirely in memory. For this, when we create a component, we did not write directly to the DOM. Instead, we are writing virtual components that will turn into the DOM leading to smoother and faster performance.

State in React:

The state is a built-in React object that is used to contain data or information about the component. A component’s state can change over time; whenever it changes, the component re-renders. The change in state can happen as a response to user action or system-generated events and these changes determine the behavior of the component and how it will render.

That’s all from me today. Hope you get a good idea about the main concept that you should learn in React. I will come with more articles in the next few days. Till then stay tuned and follow me.

Thank You ♥️

--

--