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

anonymouse703's avatar

How to link to another component via Inertia Link?

Hello guys! I'm using Inertia-vue. How to implement inertia link in vue?

This is my web route

Route::inertia('/user', 'UserList');

this my sidebar

 <Link href="users"  class="nav-link">Users</Link>

and this how I add this to the component

import { Link } from '@inertiajs/inertia-vue3'

 export default {
        setup() {
            const user = computed(() => usePage().props.value.auth.user)
            return { user }
        },
        data () {
            return {
                checkIn: faClipboardCheck,
                checkOut: faRightFromBracket,
                restaurant: faBowlFood,
                billing: faCashRegister,
                hotelSetup: faGear,
                restaurantSetup: faCogs,   
                userSetup: faUserGear,
            }
        },
        components: {
            FontAwesomeIcon,
            Link
        }
    }

and this is my controller

 public function index()
    {
        $users = User::active()->all();

        return Inertia::render('UserList', [
            'users' => $users
        ]);
    }

When I click that I got a 404 error

0 likes
4 replies
Niush's avatar
Niush
Best Answer
Level 50

The route is /user and you are using /users in Link.

anonymouse703's avatar

@Niush I have another problem my navbar, footer and sidebar is not displayed only the UserList comoponent.

anonymouse703's avatar

@Niush this is inside my Authenticated.vue

<template>
    <div>
        <div id="root" class="root mn--max hd--expanded">

            <section  id="content" class="content">
                <main>
                    <slot /> //I Assume that all the components will display here like in Laravel templating
                </main>     
                <Footer/>    
            </section>
            
            <Header/>

            <Navbar/>

            <Sidebar/>

        </div>

        <!-- SCROLL TO TOP BUTTON -->
        <div class="scroll-container">
            <a href="#root" class="scroll-page rounded-circle ratio ratio-1x1" aria-label="Scroll button"></a>
        </div>

    </div>
</template>

Please or to participate in this conversation.