Upgrade Guide for v1.0
You can find the legacy docs for Inertia.js v0.11 at legacy.inertiajs.com.
What's New
Inertia.js v1.0 focuses on simplifying the overall architecture of the project with the goal of making Inertia easier to maintain and easier to use.
It includes a number of breaking changes, mostly related to package names and updated named exports. This guide explains how to upgrade your project to v1.0.
For a complete list of all the changes, see the release notes.
New Dependencies
To use previous Inertia releases, you had to install a number of libraries, including the core library (@inertiajs/inertia), the adapter of your choice (@inertiajs/inertia-vue|vue3|react|svelte), the progress library (@inertiajs/progress), and if you were using server-side rendering, the server library (@inertiajs/server).
Moving forward you are now only required to install a single library — the adapter of your choice (Vue, React, or Svelte), and all other core libraries are automatically installed for you.
To get started, remove all of the old Inertia libraries.
1npm remove @inertiajs/inertia @inertiajs/inertia-vue @inertiajs/progress @inertiajs/server1npm remove @inertiajs/inertia @inertiajs/inertia-vue @inertiajs/progress @inertiajs/server
1npm remove @inertiajs/inertia @inertiajs/inertia-vue3 @inertiajs/progress @inertiajs/server1npm remove @inertiajs/inertia @inertiajs/inertia-vue3 @inertiajs/progress @inertiajs/server
1npm remove @inertiajs/inertia @inertiajs/inertia-react @inertiajs/progress @inertiajs/server1npm remove @inertiajs/inertia @inertiajs/inertia-react @inertiajs/progress @inertiajs/server
1npm remove @inertiajs/inertia @inertiajs/inertia-svelte @inertiajs/progress @inertiajs/server1npm remove @inertiajs/inertia @inertiajs/inertia-svelte @inertiajs/progress @inertiajs/server
Next, install the new Inertia adapter of your choice. The new adapter libraries have been renamed, and no longer include inertia- in them.
1npm install @inertiajs/vue21npm install @inertiajs/vue2
1npm install @inertiajs/vue31npm install @inertiajs/vue3
1npm install @inertiajs/react1npm install @inertiajs/react
1npm install @inertiajs/svelte1npm install @inertiajs/svelte
Renamed Imports
Next, update all the Inertia related imports in your project to use the new adapter library name. All imports are now available from the adapter library, meaning you no longer import anything from the Inertia core library, progress library, or server library.
Additionally, some exports have been renamed and previously deprecated exports have been removed. For example, the Inertia export has been renamed to router.
Here is a complete list of all the import changes:
1import { Inertia } from '@inertiajs/inertia' // [!code --]2import { router } from '@inertiajs/vue2' // [!code ++]34import createServer from '@inertiajs/server' // [!code --]5import createServer from '@inertiajs/vue2/server' // [!code ++]67import { createInertiaApp } from '@inertiajs/inertia-vue' // [!code --:5]8import { App } from '@inertiajs/inertia-vue'9import { app } from '@inertiajs/inertia-vue'10import { InertiaApp } from '@inertiajs/inertia-vue'11import { plugin } from '@inertiajs/inertia-vue'12import { createInertiaApp } from '@inertiajs/vue2' // [!code ++]1314import { Head } from '@inertiajs/inertia-vue' // [!code --:2]15import { InertiaHead } from '@inertiajs/inertia-vue'16import { Head } from '@inertiajs/vue2' // [!code ++]1718import { Link } from '@inertiajs/inertia-vue' // [!code --:3]19import { link } from '@inertiajs/inertia-vue'20import { InertiaLink } from '@inertiajs/inertia-vue'21import { Link } from '@inertiajs/vue2' // [!code ++]1import { Inertia } from '@inertiajs/inertia' // [!code --]2import { router } from '@inertiajs/vue2' // [!code ++]34import createServer from '@inertiajs/server' // [!code --]5import createServer from '@inertiajs/vue2/server' // [!code ++]67import { createInertiaApp } from '@inertiajs/inertia-vue' // [!code --:5]8import { App } from '@inertiajs/inertia-vue'9import { app } from '@inertiajs/inertia-vue'10import { InertiaApp } from '@inertiajs/inertia-vue'11import { plugin } from '@inertiajs/inertia-vue'12import { createInertiaApp } from '@inertiajs/vue2' // [!code ++]1314import { Head } from '@inertiajs/inertia-vue' // [!code --:2]15import { InertiaHead } from '@inertiajs/inertia-vue'16import { Head } from '@inertiajs/vue2' // [!code ++]1718import { Link } from '@inertiajs/inertia-vue' // [!code --:3]19import { link } from '@inertiajs/inertia-vue'20import { InertiaLink } from '@inertiajs/inertia-vue'21import { Link } from '@inertiajs/vue2' // [!code ++]
1import { Inertia } from '@inertiajs/inertia' // [!code --]2import { router } from '@inertiajs/vue3' // [!code ++]34import createServer from '@inertiajs/server' // [!code --]5import createServer from '@inertiajs/vue3/server' // [!code ++]67import { createInertiaApp } from '@inertiajs/inertia-vue3' // [!code --:5]8import { App } from '@inertiajs/inertia-vue3'9import { app } from '@inertiajs/inertia-vue3'10import { plugin } from '@inertiajs/inertia-vue3'11import { InertiaApp } from '@inertiajs/inertia-vue3'12import { createInertiaApp } from '@inertiajs/vue3' // [!code ++]1314import { usePage } from '@inertiajs/inertia-vue3' // [!code --]15import { usePage } from '@inertiajs/vue3' // [!code ++]1617import { useForm } from '@inertiajs/inertia-vue3' // [!code --]18import { useForm } from '@inertiajs/vue3' // [!code ++]1920import { useRemember } from '@inertiajs/inertia-vue3' // [!code --]21import { useRemember } from '@inertiajs/vue3' // [!code ++]2223import { Head } from '@inertiajs/inertia-vue3' // [!code --:2]24import { InertiaHead } from '@inertiajs/inertia-vue3'25import { Head } from '@inertiajs/vue3' // [!code ++]2627import { Link } from '@inertiajs/inertia-vue3' // [!code --:3]28import { link } from '@inertiajs/inertia-vue3'29import { InertiaLink } from '@inertiajs/inertia-vue3'30import { Link } from '@inertiajs/vue3' // [!code ++]1import { Inertia } from '@inertiajs/inertia' // [!code --]2import { router } from '@inertiajs/vue3' // [!code ++]34import createServer from '@inertiajs/server' // [!code --]5import createServer from '@inertiajs/vue3/server' // [!code ++]67import { createInertiaApp } from '@inertiajs/inertia-vue3' // [!code --:5]8import { App } from '@inertiajs/inertia-vue3'9import { app } from '@inertiajs/inertia-vue3'10import { plugin } from '@inertiajs/inertia-vue3'11import { InertiaApp } from '@inertiajs/inertia-vue3'12import { createInertiaApp } from '@inertiajs/vue3' // [!code ++]1314import { usePage } from '@inertiajs/inertia-vue3' // [!code --]15import { usePage } from '@inertiajs/vue3' // [!code ++]1617import { useForm } from '@inertiajs/inertia-vue3' // [!code --]18import { useForm } from '@inertiajs/vue3' // [!code ++]1920import { useRemember } from '@inertiajs/inertia-vue3' // [!code --]21import { useRemember } from '@inertiajs/vue3' // [!code ++]2223import { Head } from '@inertiajs/inertia-vue3' // [!code --:2]24import { InertiaHead } from '@inertiajs/inertia-vue3'25import { Head } from '@inertiajs/vue3' // [!code ++]2627import { Link } from '@inertiajs/inertia-vue3' // [!code --:3]28import { link } from '@inertiajs/inertia-vue3'29import { InertiaLink } from '@inertiajs/inertia-vue3'30import { Link } from '@inertiajs/vue3' // [!code ++]
1import { Inertia } from '@inertiajs/inertia' // [!code --]2import { router } from '@inertiajs/react' // [!code ++]34import createServer from '@inertiajs/server' // [!code --]5import createServer from '@inertiajs/react/server' // [!code ++]67import { createInertiaApp } from '@inertiajs/inertia-react' // [!code --:4]8import { App } from '@inertiajs/inertia-react'9import { app } from '@inertiajs/inertia-react'10import { InertiaApp } from '@inertiajs/inertia-react'11import { createInertiaApp } from '@inertiajs/react' // [!code ++]1213import { usePage } from '@inertiajs/inertia-react' // [!code --]14import { usePage } from '@inertiajs/react' // [!code ++]1516import { useForm } from '@inertiajs/inertia-react' // [!code --]17import { useForm } from '@inertiajs/react' // [!code ++]1819import { useRemember } from '@inertiajs/inertia-react' // [!code --:2]20import { useRememberedState } from '@inertiajs/inertia-react'21import { useRemember } from '@inertiajs/react' // [!code ++]2223import { Head } from '@inertiajs/inertia-react' // [!code --:2]24import { InertiaHead } from '@inertiajs/inertia-react'25import { Head } from '@inertiajs/react' // [!code ++]2627import { Link } from '@inertiajs/inertia-react' // [!code --:3]28import { link } from '@inertiajs/inertia-react'29import { InertiaLink } from '@inertiajs/inertia-react'30import { Link } from '@inertiajs/react' // [!code ++]1import { Inertia } from '@inertiajs/inertia' // [!code --]2import { router } from '@inertiajs/react' // [!code ++]34import createServer from '@inertiajs/server' // [!code --]5import createServer from '@inertiajs/react/server' // [!code ++]67import { createInertiaApp } from '@inertiajs/inertia-react' // [!code --:4]8import { App } from '@inertiajs/inertia-react'9import { app } from '@inertiajs/inertia-react'10import { InertiaApp } from '@inertiajs/inertia-react'11import { createInertiaApp } from '@inertiajs/react' // [!code ++]1213import { usePage } from '@inertiajs/inertia-react' // [!code --]14import { usePage } from '@inertiajs/react' // [!code ++]1516import { useForm } from '@inertiajs/inertia-react' // [!code --]17import { useForm } from '@inertiajs/react' // [!code ++]1819import { useRemember } from '@inertiajs/inertia-react' // [!code --:2]20import { useRememberedState } from '@inertiajs/inertia-react'21import { useRemember } from '@inertiajs/react' // [!code ++]2223import { Head } from '@inertiajs/inertia-react' // [!code --:2]24import { InertiaHead } from '@inertiajs/inertia-react'25import { Head } from '@inertiajs/react' // [!code ++]2627import { Link } from '@inertiajs/inertia-react' // [!code --:3]28import { link } from '@inertiajs/inertia-react'29import { InertiaLink } from '@inertiajs/inertia-react'30import { Link } from '@inertiajs/react' // [!code ++]
1import { Inertia } from '@inertiajs/inertia' // [!code --]2import { router } from '@inertiajs/svelte' // [!code ++]34import { createInertiaApp } from '@inertiajs/inertia-svelte' // [!code --:4]5import { App } from '@inertiajs/inertia-svelte'6import { app } from '@inertiajs/inertia-svelte'7import { InertiaApp } from '@inertiajs/inertia-svelte'8import { createInertiaApp } from '@inertiajs/svelte' // [!code ++]910import { page } from '@inertiajs/inertia-svelte' // [!code --]11import { page } from '@inertiajs/svelte' // [!code ++]1213import { inertia } from '@inertiajs/inertia-svelte' // [!code --]14import { inertia } from '@inertiajs/svelte' // [!code ++]1516import { useForm } from '@inertiajs/inertia-svelte' // [!code --]17import { useForm } from '@inertiajs/svelte' // [!code ++]1819import { useRemember } from '@inertiajs/inertia-svelte' // [!code --:2]20import { remember } from '@inertiajs/inertia-svelte'21import { remember } from '@inertiajs/svelte' // [!code ++]2223import { Link } from '@inertiajs/inertia-svelte' // [!code --:3]24import { link } from '@inertiajs/inertia-svelte'25import { InertiaLink } from '@inertiajs/inertia-svelte'26import { Link } from '@inertiajs/svelte' // [!code ++]1import { Inertia } from '@inertiajs/inertia' // [!code --]2import { router } from '@inertiajs/svelte' // [!code ++]34import { createInertiaApp } from '@inertiajs/inertia-svelte' // [!code --:4]5import { App } from '@inertiajs/inertia-svelte'6import { app } from '@inertiajs/inertia-svelte'7import { InertiaApp } from '@inertiajs/inertia-svelte'8import { createInertiaApp } from '@inertiajs/svelte' // [!code ++]910import { page } from '@inertiajs/inertia-svelte' // [!code --]11import { page } from '@inertiajs/svelte' // [!code ++]1213import { inertia } from '@inertiajs/inertia-svelte' // [!code --]14import { inertia } from '@inertiajs/svelte' // [!code ++]1516import { useForm } from '@inertiajs/inertia-svelte' // [!code --]17import { useForm } from '@inertiajs/svelte' // [!code ++]1819import { useRemember } from '@inertiajs/inertia-svelte' // [!code --:2]20import { remember } from '@inertiajs/inertia-svelte'21import { remember } from '@inertiajs/svelte' // [!code ++]2223import { Link } from '@inertiajs/inertia-svelte' // [!code --:3]24import { link } from '@inertiajs/inertia-svelte'25import { InertiaLink } from '@inertiajs/inertia-svelte'26import { Link } from '@inertiajs/svelte' // [!code ++]
It is no longer possible to manually configure Inertia using the App export. Instead, you should use the createInertiaApp() helper. See the client-side setup documentation for more information.
Progress
Previously, the progress indicator was available as a separate plugin (@inertiajs/progress). It is now installed and enabled by default.
If you haven't yet, remove the old progress library.
1npm remove @inertiajs/progress1npm remove @inertiajs/progress
1npm remove @inertiajs/progress1npm remove @inertiajs/progress
1npm remove @inertiajs/progress1npm remove @inertiajs/progress
1npm remove @inertiajs/progress1npm remove @inertiajs/progress
Next, remove the InertiaProgress import and InertiaProgress.init() call, as they are no longer required.
1import { InertiaProgress } from '@inertiajs/progress' // [!code --:2]2InertiaProgress.init()1import { InertiaProgress } from '@inertiajs/progress' // [!code --:2]2InertiaProgress.init()
Finally, if you have defined any progress customizations, you can move them to the progressproperty of the createInertiaApp() helper.
1createInertiaApp({2 progress: {3 color: '#29d',4 },5 // ...6})1createInertiaApp({2 progress: {3 color: '#29d',4 },5 // ...6})
If you're using a custom progress indicator, you can disable the default progress indicator by setting the progress property to false.
1createInertiaApp({2 progress: false,3 // ...4})1createInertiaApp({2 progress: false,3 // ...4})
Setup Arguments
We've removed the previously deprecated lowercase app argument from the setup() method in createInertiaApp(). Use App instead.
1createInertiaApp({2 // ...3 setup({ app, props }) { // [!code --]4 setup({ App, props }) { // [!code ++]5 // ...6 },7})1createInertiaApp({2 // ...3 setup({ app, props }) { // [!code --]4 setup({ App, props }) { // [!code ++]5 // ...6 },7})
Simplified Usepage
In the Vue 3 adapter, we simplified the usePage() hook to no longer require adding .value after the component, props, url and version properties.
If you're using the usePage() hook, remove all instances of .value.
1import { computed } from 'vue'2const appName = computed(() => usePage().props.value.appName) // [!code --]3const appName = computed(() => usePage().props.appName) // [!code ++]1import { computed } from 'vue'2const appName = computed(() => usePage().props.value.appName) // [!code --]3const appName = computed(() => usePage().props.appName) // [!code ++]