Skip to main content

What is React?

React is a JavaScript library for building user interfaces, developed and maintained by Meta (formerly Facebook). It’s known for declarative UI descriptions and a component-based architecture, and is used across everything from small widgets to full SPAs. React’s core idea is efficient re-rendering via a virtual DOM. When state changes, React applies only the diff to the DOM, so you don’t have to manipulate the DOM manually.
This page describes the combination of React 19 and Inertia v3. The Laravel 13 starter kit uses this stack by default.

JSX and TSX

React components are written in JSX (JavaScript XML), a syntax that lets you embed HTML-like markup directly in JavaScript.
The starter kits adopt TypeScript (.tsx) as the standard. Type definitions enhance IDE completion and help catch bugs early.
Laravel’s React starter kit uses TypeScript + TSX as the standard. All examples on this page are written in TSX.

React’s position in Laravel

History

The relationship between React and Laravel is slightly younger than Vue’s, but today they are on equal footing. In Laravel 6 (2019), authentication scaffolding was split out into the laravel/ui package, which offered React scaffolding alongside Vue. At the time, Vue was mainstream and the React version had less visibility. Laravel Breeze (2021) added the Inertia + React stack, marking the start of serious adoption. With the Laravel 12 (2025) starter kit revamp, React became fully equal to Vue (and is now shown first).

The current mainstream style: Inertia × React

The center of gravity for React in Laravel today is Inertia × React. Inertia enables a “modern monolith” architecture where data flows from Laravel controllers directly to React components without designing an API.

Setup

For new projects, using a starter kit is the easiest option.
Choosing React in the interactive prompt automatically sets up all of the following:
  • inertiajs/inertia-laravel (server-side adapter)
  • @inertiajs/react (client adapter)
  • react + react-dom (React 19 itself)
  • @vitejs/plugin-react (Vite plugin)
  • TypeScript + @types/react
  • Tailwind CSS + the shadcn/ui component library
  • The HandleInertiaRequests middleware
  • Auth screens like login and registration (already implemented in Inertia + React + TypeScript)

Manual installation

To add it to an existing project, install the server-side and client-side pieces separately.
Next, add the React plugin to vite.config.ts.
Start the Inertia app from resources/js/app.tsx.
For manual installation details (root template configuration, middleware registration, etc.), see the Inertia official docs.

Directory structure

In the starter kits, React page components live in the resources/js/pages/ directory.
Writing Inertia::render('posts/index', [...]) maps to the component at resources/js/pages/posts/index.tsx.

JSX syntax basics

React uses JSX. It’s a style of writing HTML-like syntax inside JavaScript. Here are the minimum patterns you need to read the starter kit code.

{} — variable interpolation

Inside JSX, {} embeds a JavaScript value or expression.

Conditionals — && and ternaries

React doesn’t have a directive equivalent to v-if. Use && for simple conditions and the ternary ? : for if/else.

Rendering lists — .map()

Use Array.map() to render lists. Always specify the key prop for efficient diffing.
Equivalent to Vue’s v-for :key or Svelte’s {#each}.

className — CSS class names

Because JSX compiles to JavaScript, class is a reserved word. Use className for CSS classes.

Event handlers — camelCase

Event attributes in JSX are camelCase and take a function reference.

Page component basics

Inertia page components are ordinary React components. Data passed from a Laravel controller arrives as props.

Controller

React page component

Just receive the props as component arguments and use the data passed from the controller directly. No REST API definition needed.
The <Link> component provided by @inertiajs/react routes page transitions via XHR, avoiding full browser reloads.
You write it like a normal <a> tag, but Inertia swaps only the page component in the background, giving you an SPA-like feel.

The Form component

The <Form> component from @inertiajs/react is the recommended form submission style used in the starter kit auth screens. Specify action and method as props, and receive errors and processing from the children function (render prop).

Basic usage

<Form>’s children are a function ({ errors, processing }) => JSX (render prop pattern). The Form component computes and passes these values automatically. Form fields use HTML-native name attributes rather than onChange handlers, and the browser’s standard form data collection does the work.

Starter kit pattern

The starter kit uses Wayfinder to manage routes as objects. store.form() returns an object containing the route object’s action and method, which is spread onto <Form>.
Fields listed in resetOnSuccess are automatically reset on successful submission. Use it for fields like password fields that should be cleared after submit.
Without Wayfinder, pass the URL directly like action="/login" and it behaves the same.

The useForm hook

For form handling, use @inertiajs/react’s useForm hook. It cleanly implements form state management, submission, and validation error display.

Controller side

React form component

Here are the main properties on the object returned by useForm. When validation errors are returned, useForm displays them while preserving the input values.

Shared data

Data needed on every page (the logged-in user, flash messages, etc.) is defined in the share() method of the HandleInertiaRequests middleware.
Use the usePage() hook to access shared data from a React component.
Because shared data is included on every request, keep it to the minimum needed. Wrapping in fn() for lazy evaluation ensures it’s only evaluated when actually accessed.

React hooks essentials

Here are the fundamental React hooks you should know when developing with Inertia × React.

useState — local state

useEffect — side effects

useMemo and useCallback — performance optimization


TypeScript support

The React version of the starter kit uses TypeScript by default. Combined with Inertia’s type definitions, you get type safety for props.

Global type definitions

In the starter kit, shared data types are defined in resources/js/types/index.d.ts.

Using types in page components


Summary

React shines when paired with Laravel—especially in a “modern monolith” configuration through Inertia. Its affinity for TypeScript is excellent, making it well-suited to large application development. Inertia × React combines the simplicity of a Laravel backend with the powerful React ecosystem, offering a great development experience. Creating a project from the starter kit gets you started immediately, auth screens included.

Inertia.js official docs

See the official documentation for all Inertia v3 features.
Last modified on July 13, 2026