01 / 12
A framework or Vite, Strict Mode, lint rules and writing React with AI.
React's official documentation at react.dev is excellent. This guide does not repeat it. Each lesson summarises the topic briefly and gathers the advice of experienced engineers along with the mistakes people keep making. Version: React 19.3 (September 2026).1
The prerequisite is the JavaScript lesson from Web Fundamentals. Kent C. Dodds gives the same advice: before moving to React you should be comfortable with destructuring, arrow functions, map/filter, modules and promises; most of the difficulty people meet in React is really JavaScript.2 There is a separate TypeScript guide for types; the examples here are .tsx but do not go into typing.
The React team recommends starting a new application with a framework: Next.js (App Router), React Router (framework mode), or Expo for mobile. Frameworks bring routing, data fetching and server rendering with them, and can also be published as a static site with no server.3
To learn the fundamentals of React, or to write an SPA that needs no server, Vite is enough. The documentation says plainly that this has a cost: the day you need routing, data fetching and SSR, you start writing your own small framework.4
| Situation | Recommendation |
|---|---|
| You are learning React | Vite |
| An SPA that only runs in the browser, such as a dashboard or a tool | Vite + React Router + TanStack Query |
| SEO, first-load speed and server data matter | Next.js or React Router in framework mode |
| iOS and Android | Expo |
Warning
create-react-app is no longer used. The React team retired it for new projects in February 2025.5 If a tutorial says npx create-react-app, it is out of date.
The lessons in this guide go with Vite. Topics specific to Next.js (Server Components, Server Actions) are in the Next.js guide.
$ pnpm create vite@latest my-shop -- --template react-tscd my-shop
npm install
npm run devThe Vite template comes with React 19.3, TypeScript and Oxlint.6 The files that matter:
| File | What it does |
|---|---|
index.html | The single HTML page; <div id="root"> lives here |
src/main.tsx | Attaches React to #root |
src/App.tsx | Your first component |
vite.config.ts | The Vite and @vitejs/plugin-react settings |
// src/main.tsx
import { StrictMode } from "react";
import { createRoot } from "react-dom/client";
import App from "./App.tsx";
createRoot(document.getElementById("root")!).render(
<StrictMode>
<App />
</StrictMode>,
);<StrictMode> turns on extra checks that only run in development. It renders components twice, sets up and tears down Effects and ref callbacks one extra time, and warns about old APIs.7 The point is to catch impure rendering and missing cleanup before they reach production. It does not affect the production build.
Don't
Removing StrictMode because "my Effect runs twice". Running twice is not a bug but a test that reveals one. The fix is to write the cleanup, which comes in the Effect lesson.7
The Rules of React are usually broken without any error: the application runs, but behaves wrongly. That is why linting is essential.
The Oxlint in the Vite template only turns on the rules-of-hooks rule.6 The React team's own plugin, eslint-plugin-react-hooks, includes rules based on the React Compiler's analysis in its recommended preset: it catches setting state during render, a synchronous setState inside an Effect, reading a ref during render, and defining a component inside a component. These rules work whether or not you use the compiler.8
Add the plugin to the ESLint setup from the Code Quality guide:
$ pnpm add -D eslint-plugin-react-hooks// eslint.config.js
import reactHooks from "eslint-plugin-react-hooks";
import { defineConfig } from "eslint/config";
export default defineConfig([reactHooks.configs.flat.recommended]);The recommended preset is updated as new rules are added; use it rather than turning rules on one by one.9
React Compiler adds memoization automatically at build time. It comes switched off in the Vite template because of its effect on build speed.6 To turn it on in Vite:10
$ pnpm add -D babel-plugin-react-compiler @rolldown/plugin-babel// vite.config.ts
import babel from "@rolldown/plugin-babel";
import react, { reactCompilerPreset } from "@vitejs/plugin-react";
import { defineConfig } from "vite";
export default defineConfig({
plugins: [react(), babel({ presets: [reactCompilerPreset()] })],
});What the compiler does, and how it relates to memo and useMemo, is covered in the Render performance in React lesson.
React Developer Tools is a browser extension. The Components tab shows the tree, the props and the state, and lets you change values live. The Profiler tab measures render times.11
Models have seen a great deal of old React code, so they may suggest old patterns. Even the agent skill the React team uses while writing react.dev tells the model to "be suspicious of your own knowledge; you were often trained on outdated or incorrect React patterns".12 The old advice you see most often:
| Old advice | Today |
|---|---|
create-react-app | Vite or a framework |
forwardRef | ref is an ordinary prop |
<ThemeContext.Provider> | <ThemeContext value={...}> |
useEffect + setState for a derived value | Calculate during render |
useCallback on every function | React Compiler |
Three things help:
Give it the current documentation as context. react.dev offers an llms.txt index for agents, and adding .md to the end of any page returns plain Markdown (e.g. react.dev/learn/you-might-not-need-an-effect.md).13
Make the linter the gatekeeper. The rules above check the code the AI writes too. Tell the agent to "run npm run lint before committing".
Write your rules into a skill. Project rules, and ready-made skills such as Vercel's react-best-practices, are covered in the Skills lesson.
Set up the my-shop project, change a piece of text in App.tsx and watch the page update without reloading.
Add eslint-plugin-react-hooks. Define a second component inside a component in App.tsx and read what the linter says.
Install React DevTools, select App in the Components tab and change its state.
Ask an AI tool to "set up a React project with Vite". Compare the command it suggests with this lesson.
Official docs: React's documentation; the "Quick Start" and "Thinking in React" pages are the best place to begin.14
Official docs: the "Creating a React App" and "Build a React App from Scratch" pages; they set out the difference between a framework and Vite.34
Video: the "React and AI" panel at React Conf 2025; the React team and tool authors discuss writing React with AI (day 1 stream).15
Article: Kent C. Dodds's list of the JavaScript to know before starting React.2
Sources
September 9, 2026. View Transitions and Fragment Refs becoming stable, `browser()` and Trusted Types support.
: — From 2020; the JavaScript features to know before React.
The Next.js, React Router and Expo recommendation; frameworks also being publishable without a server.
Setting up with Vite, Parcel and Rsbuild; the cost of writing your own framework.
February 14, 2025. CRA being retired for new projects, and the migration routes.
The `react-ts` template; the Oxlint setup and why React Compiler is off by default. Checked against create-vite 9.3.
Double rendering in development, and Effects and ref callbacks being run again.
The recommended rules and the compiler-backed lints.
Flat config setup and the advice to use the `recommended` preset.
Installing `reactCompilerPreset` and `@rolldown/plugin-babel` for Vite.
The browser extension, and the Components and Profiler tabs.
The React documentation's agent skill; the warning that the model should distrust old React patterns.
`llms.txt` being added to react.dev, and pages being served as `.md`.
The official React documentation, from "Quick Start" to the API reference.
Day 1 stream. The React and AI panel, moderated by Lee Robinson.
Check the lesson's main ideas with three questions.
Your progress is stored only in this browser.
Last updated: November 3, 2026