I am trying to access a ref in a child component using the Vue3 composition API, but i am unsure of how to do so. I would like to add a scroll event to the mainContentRef so i can do a fetch request to grab more data within the parent component but i can't seem to access the ref in the parent component to add the event listener to it
This is my code (some parts removed due to being unnecessary for this example):
<!-- MAIN COMPONENT -->
<template>
<PageWrap>
<template v-slot:content>
<MainContent>
<template v-slot:content />
</MainContent>
</template>
</PageWrap>
</template>
<script setup>
//access mainContentRef here because this is where the fetch request will be
</script>
<!-- MAIN CONTENT COMPONENT -->
<template>
<div id="main-content" ref='mainContentRef'>
<slot name='content'></slot>
</div>
</template>
<script setup>
import { defineProps, ref } from 'vue';
const mainContentRef = ref(0);
</script>