In Vue 3, can I create a ref from a prop that is an object to modify in my component?
<template>
<button @click.prevent="increment">You've clicked me {{ countObj.count }} times</button>
</template>
<script>
import { defineComponent, ref } from 'vue'
export default defineComponent({
props: {
startingCount: {
type: Object,
default: () => ({
count: 0
})
}
},
setup (props) {
const countObj = ref(props.startingCount)
const increment = () => {
countObj.value.count++
}
return {
countObj,
increment,
}
}
})
</script>
Would my prop also be modified when modifying countObj?