Part 1: Introduction to React & Modern Web Architecture

Part 1 Technology Updated September 12, 2026

Part 1: Introduction to React & Modern Web Architecture

Welcome to the comprehensive React JS Tutorial series! Whether you are a beginner stepping into modern frontend engineering or an experienced developer seeking deep mastery of contemporary React patterns, this guide covers foundational architecture through advanced production systems.


1. What is React?

React is an open-source, component-driven JavaScript library created by Jordan Walke at Meta (formerly Facebook) in 2011 and open-sourced in 2013. Rather than being a monolithic framework like Angular or ASP.NET MVC, React focuses strictly on the View layer of the Model-View-Controller (MVC) paradigm.

Core Tenets of React:

  • Declarative: You declare what the UI should look like for any given state, and React efficiently updates and renders the right components when your data changes.
  • Component-Based: You build encapsulated components that manage their own state, then compose them to build complex user interfaces.
  • Learn Once, Write Anywhere: React architecture powers web apps (React DOM), native mobile apps (React Native), and desktop apps (Electron).

2. Declarative vs. Imperative Programming

In traditional vanilla JavaScript, DOM manipulation is imperative—you write explicit instructions detailing how to change the DOM step by step.

The Imperative Approach (Vanilla JS):

// Step 1: Query the DOM element
const counterElement = document.getElementById('counter');
const buttonElement = document.getElementById('increment-btn');

let count = 0;

// Step 2: Manually attach listener and mutate DOM
buttonElement.addEventListener('click', () => {
  count++;
  counterElement.textContent = `Current Count: ${count}`;
  if (count > 10) {
    counterElement.style.color = 'red';
  }
});

The Declarative Approach (React):

In React, you define what the UI should look like based on state:

import { useState } from 'react';

export default function Counter() {
  const [count, setCount] = useState(0);

  return (
    <div className="p-4 border rounded shadow">
      <h2 style={{ color: count > 10 ? 'red' : 'black' }}>
        Current Count: {count}
      </h2>
      <button 
        onClick={() => setCount(count + 1)}
        className="px-4 py-2 bg-blue-600 text-white rounded"
      >
        Increment
      </button>
    </div>
  );
}

3. The Virtual DOM & Reconciliation

Direct DOM manipulation in browsers is computationally expensive because any DOM mutation triggers Reflow (calculating element layout) and Repaint (drawing pixels).

React solves this through the Virtual DOM (VDOM): 1. Virtual Representation: React maintains an in-memory lightweight JavaScript object tree mirroring the actual browser DOM. 2. State Change: When a component's state or props change, React generates a new Virtual DOM tree. 3. Diffing Algorithm: React compares the new tree with the previous tree to calculate the minimal set of changes (Reconciliation). 4. Batched Commit: React updates only the specific real DOM nodes that actually changed in a single optimized pass.

[State Change] 
      │
      ▼
[New Virtual DOM Tree] <── (Diffing / Reconciliation) ──> [Previous Virtual DOM]
      │
      ▼
[Minimal Calculated Diff]
      │
      ▼
[Batched Update to Real DOM]

4. Single Page Applications (SPAs)

Traditional websites operate on a Multi-Page Application (MPA) model: every navigation sends a GET request to the web server, which generates and returns a complete HTML document, causing a full page reload.

In a React Single-Page Application (SPA): - The browser loads a single index.html shell alongside bundled JavaScript and CSS. - Navigation between views is handled client-side by JavaScript (Client-Side Routing). - Data is requested asynchronously from backend APIs via JSON (REST or GraphQL). - The user enjoys instantaneous page transitions with zero browser flashing.


Key Takeaways

  • React is a declarative, component-based library for building interactive user interfaces.
  • The Virtual DOM provides high performance by batching and minimizing direct DOM mutations.
  • SPAs deliver smooth, desktop-grade user experiences by managing navigation on the client.

In Part 2, we will set up a lightning-fast modern development environment using Vite, Node.js, and modern tooling!