Logo - Open book, behind two sails with text, docs
-tech. annebrown.ca

Data To

Calling Component w Vars

Define Prop in Child Component

<!-- ChildComponent.vue -->
<script setup>
const props = defineProps(['myVar'])
</script>

<template>
  <div>{{ props.myVar }}</div>
</template>

Pass Var to Child Component

<!-- ParentComponent.vue -->
<script setup>
const myVar = ref('Hello from parent')
</script>

<template>
  <ChildComponent :myVar="myVar" />
</template>