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

Corronica's avatar

<Link> tag isn't working for me

Hello im following Lukes forum from scratch videos and 8th one he goes through pagination as well as using tailwind and heroicons for it.

My issues is when I use the <Link> tag instead of the tag the entire posts page breaks and shows nothing but a white window im using vue with inertia i've tried to alter the app.js as others suggested on here and other sites but its still not working.

Any help would be great please.

app.js without changes

import './bootstrap';
import '../css/app.css';

import { createApp, h } from 'vue';
import { createInertiaApp } from '@inertiajs/vue3';
import { resolvePageComponent } from 'laravel-vite-plugin/inertia-helpers';
import { ZiggyVue } from '../../vendor/tightenco/ziggy';

const appName = import.meta.env.VITE_APP_NAME || 'Laravel';

createInertiaApp({
    title: (title) => `${title} - ${appName}`,
    resolve: (name) => resolvePageComponent(`./Pages/${name}.vue`, import.meta.glob('./Pages/**/*.vue')),
    setup({ el, App, props, plugin }) {
        return createApp({ render: () => h(App, props) })
            .use(plugin)
            .use(ZiggyVue)
            .mount(el);
    },
    progress: {
        color: '#4B5563',
    },
});

Pagination.vue file

1 like
5 replies
LaryAI's avatar
Level 58

When using Vue with Inertia.js, the <Link> component is typically provided by Inertia to handle client-side navigation. If your page breaks when using the <Link> component, there are a few things you can check to troubleshoot and resolve the issue:

  1. Ensure Inertia is Properly Installed: Make sure that Inertia is correctly set up in your project. You should have the Inertia Vue adapter installed and configured in your app.js or equivalent entry file.

  2. Import the Link Component: Ensure that you are importing the Link component from Inertia in the file where you are using it. It should look something like this:

    import { Link } from '@inertiajs/inertia-vue3'; // or '@inertiajs/inertia-vue' for Vue 2
    
  3. Check Your Component Registration: If you are using Vue 3, make sure you have registered the Inertia plugin in your Vue app:

    import { createApp, h } from 'vue';
    import { createInertiaApp } from '@inertiajs/inertia-vue3';
    
    createInertiaApp({
      resolve: name => require(`./Pages/${name}`),
      setup({ el, App, props, plugin }) {
        createApp({ render: () => h(App, props) })
          .use(plugin)
          .mount(el);
      },
    });
    

    For Vue 2, it would look like this:

    import Vue from 'vue';
    import { InertiaApp } from '@inertiajs/inertia-vue';
    
    Vue.use(InertiaApp);
    
    new Vue({
      render: h => h(InertiaApp, {
        props: {
          initialPage: JSON.parse(el.dataset.page),
          resolveComponent: name => require(`./Pages/${name}`).default,
        },
      }),
    }).$mount(el);
    
  4. Verify the Link Usage: Ensure that you are using the <Link> component correctly in your template. It should look something like this:

    <Link href="/your-route">Your Link Text</Link>
    
  5. Check for JavaScript Errors: Open your browser's developer console and check for any JavaScript errors that might give you more insight into why the page is breaking.

  6. Inspect Network Requests: Use the network tab in your browser's developer tools to see if the request is being made correctly when you click the link.

  7. Tailwind and Heroicons: Ensure that Tailwind CSS and Heroicons are correctly set up and not interfering with the functionality. Sometimes, CSS issues can cause the page to appear blank.

By following these steps, you should be able to identify and fix the issue with the <Link> component in your Vue and Inertia setup. If the problem persists, consider providing more specific error messages or code snippets for further assistance.

vincent15000's avatar

Try to use <RouterLink :to="{ name: 'dashboard' }"> instead of <Link>.

Corronica's avatar

@vincent15000 Hi so doing that gives me the same result as if I would just use a lower case tag instead the page displays but I cant go through page numbers anymore

1 like
vincent15000's avatar

@Corronica When I have answered to your post, you didn't show the code yet, you have updated later.

I couldn't guess that you were using Inertia, you didn't specify it.

You should move your post to the Inertia channel instead of the Vue one, you will have more answers.

Unfortunately I can't help you with Inertia.

Please or to participate in this conversation.