My goal is to achieve the functionality described in the title. Suppose I have the following structure:
parent -> child -> secondChild
Currently, there is a variable called isActive
in the parent component. Below is how it can be implemented:
parent.vue
<child :active="isActive" />
child.vue
<template>
<secondChild :active="props.active">
</template>
<script setup>
const props = defineProps(['active'])
</script>
secondChild.vue
<template>
{{isActive}}
</template>
<script setup>
const props = defineProps(['active'])
</script>
While this method works, it may not be optimal when dealing with multiple nested components. Any suggestions on achieving this without relying on pinia
or vuex
?
Appreciate any guidance.