For some reason, I receive "Uncaught ReferenceError: quizz is not defined" if I call a function.
<script setup>
import { defineProps } from "vue";
import { useRouter } from "vue-router";
const router = useRouter();
const props = defineProps(["quizz"]);
const navigateToQuiz = () => {
router.push(`/quizz/${quizz.id}`);
};
</script>
<template>
<div class="card" @click="navigateToQuiz">
<img :src="quizz.img" :alt="quizz.name" />
<div class="card-text">
<h2>{{ quizz.name }}</h2>
<p>{{ quizz.questions.length }} questions</p>
</div>
</div>
</template>
What should I do? Thanks!
If I do the router.push directly to the @click, it works and takes me to the next page (/quizz/:id)