Building with AdonisJS & Inertia #2.3

The Link Component and Programmatic Linking

In This Lesson

We'll explore Inertia's Link component and its props. We'll then examine how to link between pages programmatically using Inertia's router.

Created by
@tomgobich
Published

⏳ Chapters

00:00 - Replace History State
01:15 - POST, PUT, PATCH, and DELETE Actions
03:00 - Preserving Scroll Position
04:08 - Specifying the Link Element
04:42 - Programmatic Linking with Inertia's Router
07:17 - Cleaning Up

Join the Discussion 2 comments

Create a free account to join in on the discussion
  1. @jean-louis

    How can I make use of route identifiers ? Especially for programmatic linking.

    1
    1. Responding to jean-louis
      @tomgobich

      Hi Jean!

      You can achieve that by using Tuyua! From it's documentation, once installed & configured it'll allow template & programmatic linking using route identifiers like the below:

      <script setup lang="ts">
      import { Link, useRouter } from '@tuyau/inertia/vue'
      
      const router = useRouter()
      
      function visit() {
        router.visit('users.posts.show', { id: 1, postId: 2 })
      }
      </script>
      
      <template>
        <div>
          <Link route="users.posts.show" :params="{ id: 1, postId: 2 }">Go to post</Link>
          <button type="button" @click="visit">Go to posts</button>
        </div>
      </template>
      Copied!
      • inertia
      • pages
      • Home.vue
      1