I'm using props to update my site content in the child component. This is basically working like this:
<child-component :updatedArray="updatedArray" />
then in the child component:
<template>
{{updatedArray}}
<div>{{computedArray}}</div>
</template>
<script>
props: ['updatedArray'],
...
computed: {
computedArray() {
if(this.updatedArray.item == "item one") {return "item one"}
else {return "other item"}
}
}
</script>
Now this code should work in any case when I update updatedArray in my parent component. Then I see in my child component that my {{updatedArray}} is changing correctly, but my computedArray is not triggered and does not work.
Can I ask you why is this happening? Does computed do not work with every props update?
How should I correct my code?
edit: not duplicate I'm not mutating the prop, I rather only do a computed based on its value.
updatedArraybut you are testing a key on it withupdatedArray.item. What isupdatedArray? An array or something else? - Markv-bind:updated-array="updatedArray"- Sphinx