You have almost got it…
<script setup>
let props = defineProps({
compo: String
});
</script>
<template>
<h1>{{ compo }}</h1>
</template>
You need the props.compo within the script only
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I'm passing data to my component <Dashboard compo="Developer"> from my component Developer but im getting undefined in Dashboard
Developer.vue
<script setup>
import Dashboar from '@/Pages/Dashboard.vue';
</script>
<template>
<Dashboard compo="Developer">
<!--Some Html-->
</Dashboard>
</template>
Dashbard.vue
<script setup>
defineProps({
compo: String
});
</script>
<template>
<h1>{{ compo }}</h1> <!--getting undefined-->
</template>
How can I solve this?
Please or to participate in this conversation.