[Vuejs]-Uncaught TypeError: Cannot read properties of undefined (reading 'post') โ€“ Creating a Laravel Vue page with Inertia.js

0๐Ÿ‘

If you are using setup you do like my code for better user formatting

First you cannot access route() inside a .vue file it only accessible via .blade extension.

Second separate your function from your template.

<template>
...
<form @submit.prevent="submit">
...
</form>
...
</template>
<script setup>
import {Link, useForm} from "@inertiajs/inertia-vue3"

const form = useForm({
    name: '',
    email: '',
    password: '',
})

const submit = () => form.post('/store')

</script>

Leave a comment