Lesson 1.0

Introduction to React

When React first launched in 2013, developers really didn't like it. At first glance, that reaction made perfect sense — React looked nothing like the tools developers were familiar with at the time.

What you'll learn
  • What web development looked like before React
  • Why React was initially controversial
  • The key innovations React introduced
  • How JSX changed the way we write UI
  • Why React is dominant today

The Web Before React

In the early 2010s, front-end development was a completely different universe. Three technologies dominated:

jQuery

The King of DOM Manipulation

Backbone.js

Minimalism and MVC

AngularJS

Batteries-included framework

jQuery: The King of DOM Manipulation

jQuery embraced the reality of the web: a tree of DOM nodes. Your application's "state" effectively lived in the DOM itself. Updating the UI meant:

  • 1.Finding the right DOM node
  • 2.Mutating it
  • 3.Hoping you didn't break something somewhere else
javascript
// jQuery example - imperative DOM manipulation
$('#submit-btn').click(function() {
  var name = $('#name-input').val();
  if (name) {
    $('#greeting').text('Hello, ' + name + '!');
    $('#greeting').show();
    $('#name-input').val('');
  }
});

jQuery revolutionized browser compatibility and developer ergonomics... but it also created a world of shared mutable state. As applications grew, that state became impossible to track. jQuery projects often devolved into unpredictable "spaghetti code."

The Problem

The web needed more structure. Shared mutable state made complex apps impossible to reason about.

Backbone.js: Minimalism and the Rise of MVC

Backbone.js introduced a lightweight, JavaScript-friendly version of MVC:

  • Models stored application state
  • Views re-rendered when models changed
javascript
// Backbone.js example
var UserModel = Backbone.Model.extend({
  defaults: {
    name: '',
    email: ''
  }
});

var UserView = Backbone.View.extend({
  render: function() {
    // Developer had to define their own rendering logic
    this.$el.html('<h1>' + this.model.get('name') + '</h1>');
    return this;
  }
});

At only ~2,000 lines of code, it was intentionally minimal and unopinionated. So unopinionated, in fact, that Backbone's default render() method did nothing. Developers had to define their own rendering and templating strategies.

Key Insight

Backbone brought order — but still put a lot of burden on the developer.

AngularJS: "What if HTML Was More Powerful?"

AngularJS took the opposite approach. It was a fully opinionated, batteries-included framework offering:

Two-way data binding
Templates
Routing
Dependency Injection
Filters
Built-in DOM utilities
javascript
<!-- AngularJS example - two-way data binding -->
<div ng-app="myApp" ng-controller="myCtrl">
  <input ng-model="name">
  <p>Hello, {{name}}!</p>
</div>

<script>
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope) {
  $scope.name = 'World';
});
</script>

It was incredibly powerful, especially for backend developers suddenly tasked with building frontends. But Angular's biggest feature was also its biggest problem:

Two-way data binding
  • The view updated the model
  • The model updated the view
  • Angular continually scanned for changes

This often led to implicit state changes, performance issues, and debugging nightmares.

The Common Problem: Mutation Everywhere

Despite their differences, nearly all frameworks of the era shared one characteristic:

Stateful, mutable models that synchronized with the view

Mutation made complex apps harder to reason about and maintain. Developers needed a better mental model. And that's exactly what React introduced.

React's Breakthrough: UI as a Pure Function of State

One of React's core innovations was the idea that your UI is a function of your state:

v = f(s)

view = function(state)

Instead of manually manipulating the DOM:

  • 1.You update the state
  • 2.React figures out how the UI should look

The Result

This shift eliminated entire classes of bugs caused by uncontrolled mutations.

Components: Bringing Functional Thinking to UI

React wrapped this idea inside a component-based architecture. Components:

Accept props (inputs)
Manage internal state
Return UI descriptions
Compose like functions
javascript
// React component - declarative UI
function Greeting({ name }) {
  const [count, setCount] = useState(0);

  return (
    <div>
      <h1>Hello, {name}!</h1>
      <p>You clicked {count} times</p>
      <button onClick={() => setCount(count + 1)}>
        Click me
      </button>
    </div>
  );
}

Key Insight

Your intuition about functions — composition, reuse, isolation — suddenly applied directly to UI development. This was radical compared to imperative DOM manipulation.

JSX: The Most Hated Feature That Became a Superpower

React needed a way to describe UI inside components. The logical answer was HTML — but HTML couldn't exist directly inside JavaScript... until React invented JSX.

JSX combined:

  • The expressiveness of JavaScript
  • The readability of HTML
Developers initially hated it

"HTML in JavaScript? That violates Separation of Concerns!"

But React had a different interpretation:

Separation of Concerns is about conceptual boundaries, not file extensions. In React's world, everything relating to rendering a component — its state, UI, and even styling — belongs together.

Once developers built real applications with JSX, they quickly realized its power.

React Today: A UI Primitive for Modern Frameworks

From 2014 to 2020, React was mostly used for single-page applications with React Router. But modern development has evolved.

Today, React is treated as a UI primitive inside larger metaframeworks like:

Next.js
Remix
Astro

These frameworks add features like server-side rendering, routing, streaming, and bundling — while React stays focused on what it does best:

Building UI through components

Philosophy Unchanged

Philosophically, React hasn't changed much. Its foundations are the same: State → UI, Components → composition, Declarative over imperative. But the ways we use React have become more powerful.

Summary

React succeeded because it dared to challenge the status quo:

Key Takeaways
  • It replaced mutation with pure functions
  • It unified UI and logic inside components
  • It combined HTML and JavaScript with JSX
  • It provided a predictable mental model
  • It enabled a new ecosystem of composable UI

What started as a controversial, disliked library evolved into the backbone of modern front-end development. And whether you use React directly or through a meta-framework, its influence is everywhere.