Everything looks correct; except maybe a typo PostPage or PostsPage
The corresponding PostPage.vue file
return inertia('PostsPage',[
Have you checked Vue devtools in the browser?
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi I don't understand why my code isn't sharing the props I define in my web.php file...
my Web.php route
use Illuminate\Support\Facades\Route;
Route::get('/posts', function () {
return inertia('PostsPage',[
'username'=>'Emil'
]);
});
The corresponding PostPage.vue file
<template lang="">
<Head title="EBAdev - Posts" />
<div class="text-xl">
This is a super simple webpage
<p>{{ username }}</p>
</div>
</template>
<script setup>
defineProps({ username: String });
</script>
My resources/js/app.js file:
import { createApp, h } from "vue";
import { createInertiaApp, Link, Head } from "@inertiajs/inertia-vue3";
import { InertiaProgress } from "@inertiajs/progress";
import Layout from "./components/layout/AppLayout";
createInertiaApp({
resolve: (name) => {
let page = require(`./Pages/${name}`).default;
page.layout ??= Layout;
return page;
},
setup({ el, App, props, plugin }) {
createApp({ render: () => h(App, props) })
.use(plugin)
.component("Link", Link)
.component("Head", Head)
.mount(el);
},
});
InertiaProgress.init();
and this Is what the website renders:
<div class="text-xl"> This is a super simple webpage <p></p></div>
Please or to participate in this conversation.