Inside setup() it should be props
[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.
@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);
},
});
@hamzaelmaghari I assume that's just something you need inside the layout? Can't you just use usePage() there?
@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
@hamzaelmaghari I think it only sends it to the setup method, not createInertiaApp() directly
@Sinnbeck It's partialy done with const brand = computed(() => usePage().props.value.config.name)
@hamzaelmaghari yeah something like that. I'm a react user myself so I don't know the exact syntax :)
@Sinnbeck It's working know. Yes, react is wonderful but, not easy 🥲 Do you have any knowledge in Laravel Fortify? if so, could you let me know what to do in order to override session flush messages? I have an idea to override the default responses myself but I just wanted to know if that's good or not for performance.
https://github.com/laravel/fortify/tree/1.x/src/Http/Responses
@hamzaelmaghari I just started using it this week. But make a new thread describing it and I will do my best to help :)
@Sinnbeck Sure doing it right now. Thanks
Please or to participate in this conversation.