Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: @tuyau/inertia with Vue/React Link components #2

Merged
merged 11 commits into from
May 12, 2024
Merged

Conversation

Julien-R44
Copy link
Owner

This PR introduces a new @tuyau/inertia package. Goal is to add some components to provide greater type-safety on AdonisJS x InertiaJS apps.

With this PR, we're only adding the Link component, for React and Vue, which is a wrapper of the InertiaJS Link component, but type-safe.

Usage is super easy : just import Link from @tuyau/inertia rather than @inertiajs/inertia-react or @inertiajs/inertia-vue.

<script setup lang="ts">
import { Link } from '@tuyau/inertia'
</script>
<template>
  <Link route="posts.edit" :params="{ id: 2 }">Home</Link>
</template>

Same for React :

import { Link } from '@tuyau/inertia'

export function MyComponent() {
  return (
    <Link route="posts.edit" params={{ id: 2 }}>Home</Link>
  )
}

Link component has the same props as the InertiaJS Link, except for the href and method props, which are not needed anymore and replaced by the route and params props.

@Julien-R44 Julien-R44 merged commit 2da60a7 into main May 12, 2024
6 checks passed
@Julien-R44 Julien-R44 deleted the feat/inertia branch May 12, 2024 23:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant