What is React?

srijan1709

Srijan

Posted on March 15, 2022

What is React?

React is a free and open-source JavaScript library. You can build fast and interactive user interfaces with React. React is maintained by Meta and React community (consisting of individual developers and companies).

React is generally used for building single-page applications, mobile apps, and server-rendered applications. React is very popular with 184k stars on GitHub and is usually the first choice of a developer working on SPA’s these days.

Let’s learn about the features that make React stand out among the front-end libraries.

React is Component-based

Components are isolated pieces of code that represent a piece of user interface like buttons, text box, navigation bar, etc. It is a JavaScript function or class which accepts properties (props) and returns a react element.

React element is a lightweight description of what to render. React takes the description (React element) and displays the result (component).

React component - codingvarsity

React is declarative

React follows the declarative paradigm. When we instruct React what to render for each state, it will update the right components when the data changes. It simplifies stuff and makes your code more predictable and easier to debug.

JSX

JSX is a syntax extension to JavaScript. It describes what UI should look like in each state thus helps in writing declarative code. It also shows more useful error and warning messages.

const element = <h1>coding varsity</h1>
Enter fullscreen mode Exit fullscreen mode

Don’t worry about the syntax, we will look into JSX in more detail in another article.

React allows only one-way data flow

React apps consists of a series of nested components. Data is passed in one direction - from the parent to the child component using props.

React allows only the unidirectional flow of data. But what if a child component wants to update something in the interface? We will learn about how to do this in another article.

Unidirectional data flow - codingvarsity

React is fast

React does not work on the DOM directly. Instead, it creates a virtual DOM in memory and compares it with the original DOM. If there is a difference, react update only the part of DOM which is changed. It does not render the whole web page again.

Summary

  • React is a free and open-source JavaScript library. You can build fast and interactive user interfaces with React.
  • React is generally used for building single-page applications, mobile apps, and server-rendered applications.
  • React is component-based.
  • You write declarative code when working with React. It makes your code more predictable and easier to debug.
  • React allows only one-way binding.
  • React is fast. It only updates part of DOM that is changed instead of rendering the whole page again.
💖 💪 🙅 🚩
srijan1709
Srijan

Posted on March 15, 2022

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related