The client needs npm 2,036 install @inertiajs/react @inertiajs/vite react react-dom @vitejs/plugin-react, inertia() and react() in the Vite 25,978 plugins, and resources/js/app.jsx as an input. That entry point is just createInertiaApp(), since the @inertiajs/vite plugin finds pages in resources/js/pages and mounts the app. A page receives the controller's props:
import { Link } from '@inertiajs/react';
import { show } from '@/actions/App/Http/Controllers/BookController';
export default function Show({ book }) {
return (
<main className="p-8">
<h1 className="text-2xl font-semibold">{book.title}</h1>
<p>${book.price.toFixed(2)}, {book.stock} in stock</p>
<Link href={show.url('9780000000002')}>Next title</Link>
</main>
);
}<Link> fetches the next page object instead of reloading. The build emitted this page as its own 1.95 kB chunk beside a 342.72 kB app bundle, 107.14 kB gzipped: React 7,897 and Inertia 515,106 are the price (React itself is covered in MERN Stack Development). Against a standalone SPA:
| Concern | Inertia + React | Standalone React SPA |
|---|---|---|
| Routes and data | Laravel 2,157 routes, controller props | React Router 139,386 , fetch, loading states |
| Authentication | Session cookie, CSRF built in | Sanctum 2,988 cookies or tokens, CORS |
| Deployment and SEO | One build; Inertia SSR | Two builds; an SSR framework |