What is React and why to use it?

React is a JavaScript library (not a framework) for building user interfaces. Created by Facebook (now meta) in 2013 to handle complex, fast-changing UI’s. Designed for component-based architecture you build small, reusable pieces (components) and combine them to make big apps.

The Problem React Solves

You had to manually update the DOM (HTML elements) using plain JavaScript or jQuery. That was slow, error-prone, and hard to maintain as apps grew larger.

Why You Should Use React

Bundler

Browser only understands HTML, CSS & JS. Bundler takes all the files and convert’s them into the plain HTML, CSS and JS. It converts also the high level code to the browser understandable code. Vite is currently the most famous.

What is reconciliation?

In React, reconciliation is the process React uses to update the UI efficiently when state or props change.

Instead of rebuilding the whole DOM every time, React:

  1. Creates a new Virtual DOM
  2. Compares it with the previous Virtual DOM
  3. Finds the differences (diffing)
  4. Updates only the changed parts in the real DOM

This makes React fast and efficient.