'Grandchild from sibling A emits, parent updates the value, but sibling B is not updating
This is the parent template with 2 children
<payment :isEditing="isEditing" @action="onActionButtonClick" />
<create-details v-if="isCompanyDetailsCreating" @action="onActionButtonClick" />
Inside the child create-details I have a grandchild that emits onActionButtonClick, it's received by the parent and the parent it changes the value of isEditing.
My problem is that this value change in isEditing, I'm not receiving inside payment component. This is what I have tried inside PaymentComponent, but it's not working
props: {
isEditing: { type: Boolean as PropType<boolean>, default: false },
},
emits: ['action'],
setup(props, { emit }) {
const isEditingButton = ref(props.isEditing)
watch(props.isEditing, (first, second) => {
isEditing.value = props.isEditing
})
The error I'm receiving in the watch warning is this one. Would be great if someone could help me. I know I could achieve it with store, but I would appreciate help.
Argument of type 'boolean' is not assignable to parameter of type 'readonly WatchSource[]'>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
