Inertia.js v3.0.0 Is Here with Optimistic Updates, useHttp, and More
Last updated on by Paul Redmond
Inertia.js v3.0.0 is now released. We covered the beta earlier this year, and the final release ships with those features alongside a number of fixes and refinements accumulated during the beta period. The release touches the core package and all three adapters (React, Vue, and Svelte).
Key highlights:
- Built-in XHR HTTP client replaces Axios as a required dependency
- New
useHttphook for making non-navigation HTTP requests - First-class optimistic update support across the router,
useForm, anduseHttp - Layout props API replaces event bus and provide/inject workarounds
- SSR now works in Vite development mode without a separate server process
What's New
Built-In XHR Client — Axios Now Optional
Axios is no longer a required dependency. Inertia now ships its own XHR client, which removes Axios (~15KB gzipped) from your bundle by default. If you rely on Axios interceptors or need to preserve existing behavior, Axios is still available as an optional peer dependency.
The qs package was also removed. Install it directly if your application depends on it.
PR: #2833
useHttp Hook
The new useHttp hook covers the long-standing gap for making HTTP requests that don't trigger a page navigation. It returns reactive state — processing, errors, progress, and isDirty — matching the DX of useForm. It also integrates with Precognition 2.x for real-time validation.
const http = useHttp({ query: '',}) const search = () => { http.get('/api/search').then((results) => { console.log('Found:', results.length) })}
This hook is intended for routes that return response()->json(), not Inertia::render(). A withAllErrors option is also supported for returning all validation errors at once rather than the first per field.
Optimistic Updates
Inertia v3 adds a first-class optimistic update API across the router, useForm, and useHttp. Changes are applied immediately to page state and automatically rolled back on non-2xx responses. Only keys explicitly defined in the callback are snapshotted. Concurrent optimistic updates are also handled — multiple in-flight requests each carry their own rollback snapshot.
// Fluentrouter .optimistic((props) => ({ todos: [...props.todos, { id: Date.now(), name, done: false }], })) .post('/todos', { name }) // Inline optionrouter.post('/todos', { name }, { optimistic: (props) => ({ todos: [...props.todos, { id: Date.now(), name, done: false }], }),})
The <Form> component also gains an optimistic prop, and both optimistic and transform callbacks now have generic type inference.
const form = useForm({ name: '' }) const addTodo = () => { form .optimistic((props) => ({ todos: [...props.todos, { id: Date.now(), name: form.name, done: false }], })) .post('/todos')}
Layout Props
useLayoutProps and setLayoutProps give pages a clean way to pass data into their layout without reaching for an event bus or provide/inject. Layouts declare defaults; pages call setLayoutProps() to override them. The final implementation passes layout props directly as component props.
SSR in Vite Development Mode
SSR now works during npm run dev without running a separate Node.js server process. The Vite plugin handles it automatically, and a flash-of-unstyled-content fix is included. For production, the workflow is unchanged: vite build && vite build --ssr, then php artisan inertia:start-ssr.
More in v3
The following features also ship in v3.0.0. See the official documentation and upgrade guide for full details:
- Instant Visits (#2907) — swap to the target page component immediately using shared props before the server responds; page-specific props merge in on arrival
createInertiaApp()without arguments (#2883) — can now be called with zero config when using the Vite plugin; alayoutoption andwithAppcallback were also added (#2884, #2949)preserveFragmentoption (#2897, #2899) — preserve URL fragments across redirects, with server-side support in the Laravel adapterpreserveErrorsoption (#2819) — retain validation errors during partial reloads<Deferred>reloadingslot prop (#2860) — the component no longer resets on partial reloads; use the new slot prop to handle that state yourselfHttpErrorbase class (#2999) — a typed base class for HTTP exceptions in the event system- Popover API progress bar (#2917) — the progress bar is rewritten using the browser's native Popover API
- React Strict Mode (#2909) — pass
strictMode: truetocreateInertiaApp()to enableReact.StrictMode - Svelte 5 adapter (#2677) — rewritten with rune syntax; Svelte 4 is dropped
SharedPagePropsin event andcreateInertiaApptypes (#2956) — shared props are now included in the TypeScript types for events and app setup
Upgrade Notes
This is a major release with breaking changes, including updated framework version requirements, the Axios removal, ESM-only output, and a number of renamed APIs. Review the official upgrade guide for the full list before upgrading.
To upgrade:
npm install @inertiajs/vue3@^3.0 # or @inertiajs/react / @inertiajs/sveltenpm install @inertiajs/vite@^3.0composer require inertiajs/inertia-laravel:^3.0
References