React Introduction

Introduction to React.js and its key features.

React Introduction

React is a JavaScript library for building user interfaces.

React is used to build single-page applications.

React allows us to create reusable UI components.

What is React?

React, sometimes referred to as React.js or ReactJS, is an open-source JavaScript library for building user interfaces.

It is maintained by Facebook and a community of individual developers and companies.

React can be used as a base in the development of single-page or mobile applications.

Why React?

  • Simplicity: React makes code easier to understand and launch.
  • Easy to learn: Anyone with a basic previous knowledge of programming can easily understand React.
  • Native Approach: React can be used to create mobile applications (React Native).
  • Data Binding: React uses one-way data binding and an application architecture called Flux controls the flow of data to components through one control point - the dispatcher.
  • Performance: React does not offer any concept of a built-in container for dependency. You can use Browserify, Require JS, EcmaScript 6 modules which we can use via Babel, ReactJS-di to inject dependencies automatically.
  • Testability: React applications are super easy to test.

Example

import React from 'react';
import ReactDOM from 'react-dom/client';

class Car extends React.Component {
  render() {
    return <h2>Hi, I am a Car!</h2>;
  }
}

const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(<Car />);