Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

hamzaelmaghari's avatar

[HELP] Inertia props

Hello devs! I'm trying to send a prop to Vue Js component using Inertia's via Shared Data feature.

It works fine, but, What I need to achieve here is using that prop inside createInertiaApp() method.

0 likes
10 replies
hamzaelmaghari's avatar

@Sinnbeck How I can call it? via $page.props.x.x ? doesn't work.

Here is my code:

createInertiaApp({
    title: (title) => `${title} - ${FIXED}`, // I need fixed title via prop
    resolve: (name) => resolvePageComponent(`./pages/${name}.vue`, import.meta.glob('./pages/client/**/*.vue')),
    setup({el, app, props, plugin}) {
        return createApp({render: () => h(app, props)})
                .use(plugin)
                .component('Link', Link)
                .component('Head', Head)
                .mount(el);
    },
});
1 like
hamzaelmaghari's avatar

@Sinnbeck Yes I could do that easily by using layout title and extend the title to other components but, I prefer to use title inside setup file.

I think Inertia doesn't send props directly to app.js file, so the only think I can do is using title in the Layout component.

Can you help with something else? related to Fortify.

Thanks <3

Sinnbeck's avatar

@hamzaelmaghari I just started using it this week. But make a new thread describing it and I will do my best to help :)

1 like

Please or to participate in this conversation.