
This is part of a series on the modern web stack, written from a WordPress developer’s seat for people who’ve built on the web for years and still hit stack terms they can’t confidently define. The goal is literacy, enough that you can read any stack list and know what each piece does.
Each post has a 10-15 minute audio companion, generated with NotebookLM, for the gym or the commute.
For about a year I avoided React. Every explanation I read came from someone who had never touched WordPress, and the analogies didn’t fit. Components were “like Lego bricks.” State was “like a database, but inside your browser.” JSX was “just HTML with JavaScript powers.” None of it stuck because none of it connected to anything I already knew.
This post maps React onto things a WordPress developer already knows: template parts, $args, the request lifecycle. If you’ve read the JavaScript and TypeScript primer for PHP people, the syntax below will look familiar.
What React Is
A React application is a tree of components. A component is a function that takes some input and returns markup. The framework re-runs the function whenever the input changes and re-renders the affected parts of the page.
Everything else in React is a variation on three pieces: components, props and state.
Components are template parts that grew up
In WordPress, a template part is a chunk of HTML in its own file (template-parts/content.php, template-parts/header.php) that you pull into a parent template with get_template_part(). It saves you from repeating yourself across the loop, the single post template, the archive and the homepage.
A React component works the same way, with two differences. The markup and the logic live in the same file. And the component is a JavaScript function, so it can hold internal state, run side effects and react to events without bolting on jQuery.
The simplest React component:
function PostCard({ title, excerpt }) {
return (
<article className="post-card">
<h2>{title}</h2>
<p>{excerpt}</p>
</article>
);
}
You use it elsewhere like this:
<PostCard title="Hello world" excerpt="My first post" />
That’s the React equivalent of:
<?php get_template_part('template-parts/post-card', null, [
'title' => 'Hello world',
'excerpt' => 'My first post',
]); ?>
Same idea, different syntax. The HTML-looking part in angle brackets is JSX. It’s JavaScript syntax that gets compiled into function calls before it reaches the browser, and curly braces let you drop JavaScript expressions inside it, which is what {title} does.
Props are what you pass in
The argument to your component function is called props, short for properties. It’s a plain JavaScript object with whatever keys you decide to support. In WordPress that’s the $args array you hand to get_template_part(). In React it’s the first parameter of the component function.
function UserBadge({ user, size = 'medium' }) {
return <span className={`badge badge--${size}`}>{user.name}</span>;
}
The default value (size = 'medium') works like PHP’s default function arguments. Props are read-only inside the component. To change something, you reach for state.
State is what the component remembers between renders
This is where React departs furthest from WordPress. A WordPress template has no memory: each request starts fresh, the template runs, outputs HTML and dies. To remember something between requests, you put it in the database or the session.
A React component might re-render dozens of times during a single page view. The user clicks a button and the count goes up. The user types in a search box and the filtered list updates. The function runs again from the top each time, so how does it remember the current count or the current query?
Through the useState hook:
import { useState } from 'react';
function Counter() {
const [count, setCount] = useState(0);
return (
<button onClick={() => setCount(count + 1)}>
Clicked {count} times
</button>
);
}
useState(0) says “give me a piece of memory, initialized to zero, and a function to update it.” When you call setCount(count + 1), React schedules a re-render. The function runs again, useState returns the new value, and the component shows the new number.
PHP developers find this odd because a PHP script has no “between runs” to remember anything in. The nearest analogues are a JavaScript closure or a long-running PHP process with persistent variables, and WordPress works like neither.
There are other hooks: useEffect for side effects, useMemo for caching computations, useContext for sharing data across the tree. They follow the same pattern as useState. You call a function starting with use and get back a value, and sometimes an updater.
The WordPress Analogue
React components are template parts that own their own state. Props are
$args. TheuseStatehook is the database-and-session combo, except it lives in browser memory and only lasts until the page refreshes.WordPress renders the page once per request and then forgets everything. React keeps the application alive in the browser and re-runs your component functions every time the data they depend on changes. Once that clicks, the rest of React is patterns for managing what data changes when.
The React Ecosystem, Mapped
React itself is one library. An ecosystem has grown around it, and you’ll see its tools referenced together as if they were a single thing. A rough map:
| Tool | What it does | When you meet it |
|---|---|---|
| React | The core library: components, props, state, hooks | Every modern frontend job ad in 2026 |
| JSX | Syntax extension that lets you write HTML-like markup inside JS | Nearly every React project |
| Next.js | A meta-framework built on React; adds routing, server rendering and file structure | The default React framework for full apps |
| React Router | Only the routing piece, for projects that don’t want a full meta-framework | Single-page apps and tools |
| Remix | A meta-framework that merged into React Router 7 in 2024 | Older codebases that haven’t migrated yet |
| Preact | A lightweight React alternative with the same API | Used by Astro by default; useful when bundle size matters |
| Vue, Svelte, Solid | React’s competitors | Different ecosystems, similar mental model |
For jobs or client work, learn React first. It’s the lingua franca. Vue and Svelte have devoted communities and arguably nicer ergonomics, but React is what around 70 percent of the modern frontend job market expects.
Two more terms you’ll meet constantly. Server components are React components that run on the server, return HTML and can’t hold client-side state. Client components are the ones described above. Next.js mixes both, and the Next.js post covers what that means in practice.
What This Changes for WordPress People
If you can write a WordPress theme that uses ACF custom fields, conditional template loading and a custom loop, you can write React. Templating was the easy part of WordPress development. The lifecycle took the effort: when each hook fires, what’s in scope, which filters apply. React has its own lifecycle (mount, render, re-render, unmount), and it’s much simpler and better documented.
Three things become possible once React clicks.
You can read any Next.js, Remix or Astro repo
Component code dominates these codebases, so once you can parse a component file you can mostly find your way around the project. It’s also the prerequisite for headless WordPress, where a React frontend sits in front of your content.
Custom Gutenberg blocks become approachable
The block editor is built on React. If you’ve wanted to ship a custom block beyond what the editor allows out of the box, this is the way in. The block API is awkward, but the React inside it is the same React you’d use anywhere else.
Your AI-paired workflow improves
AI agents generate React code constantly. Without React fluency you can’t evaluate, modify or debug what they produce. With it, you can iterate fast.
Traps on First Contact With React
A few traps catch WordPress developers early.
className instead of class
Because class is a reserved word in JavaScript, JSX uses className for CSS classes, and htmlFor instead of for. Small, annoying and easy to forget for a year.
Lists need a key prop
When you render a list of components from an array, each item needs a unique key prop so React can track which is which between renders. Forgetting it works fine most of the time, then breaks in confusing ways when items reorder.
The infinite re-render trap
If you update state inside the render function without a guard, the component re-renders, which updates state again, which triggers another render. The browser tab crashes. useEffect exists to handle “do this once when the component appears” patterns safely.
State is local until you lift it
A useState value lives inside one component. If two siblings need to share state, you lift it up to the common parent and pass it down as props. WordPress doesn’t have this problem because state lives in the database. React makes you decide where state belongs.
Hooks run in the same order every render
You can’t put useState inside an if statement, and the linter will flag it. This rule catches the most beginners.
From Reading React to Writing It
To go from “I can read React” to “I can write React,” these are worth your time.
YouTube, gym or commute friendly
- “React in 100 Seconds” by Fireship, followed by “Learn React” by Scrimba (free, interactive). The 100-second version orients you, and the Scrimba course builds the skill.
- “The React Hooks Crash Course” from webdevsimplified.com (about 30 minutes). It covers
useState,useEffectanduseContextwith examples. Watch on a phone, then sit down and try the patterns yourself.
Official docs worth bookmarking
- react.dev: the official React docs, and the “Learn React” tutorial is the path I’d take starting from zero.
- react.dev/reference: the API reference. Search for a hook and get a clean explanation with examples.
- Patterns.dev: where to learn how the patterns fit together once you’re writing real React.
The next post introduces Next.js, the meta-framework that turns React from a UI library into a full application platform. If WordPress was your CMS, Next.js wants to be your everything.

Leave a Reply