0👍
Consider using a computed property instead of a ref. Computed properties inherently monitors their reactive dependencies, so any changes in props.fruit
will effectively trigger reactivity.
Code Changes:
<script lang="ts" setup>
const props = defineProps<{ fruit: string }>()
const fruitColor = computed<FruitColor>(() => getColor(props.fruit));
</script>
- [Vuejs]-How to pass data for chart in chart.js without getting a type error
- [Vuejs]-Why does the VueMultiselect is always open by default when using within HeadlessUI Dialog/modal
Source:stackexchange.com