Hey everyone, I'm seeking clarity on Vue props data. I've been passing values from a parent component to a child component. The issue I'm facing is that when the data in the parent component changes or updates, it doesn't reflect in the child component.
Vue.component('child-component', {
template: '<div class="child">{{val}}</div>',
props: ['testData'],
data: function () {
return {
val: this.testData
}
}
});
However, if I use the props name {{testdata}}, it correctly displays the data from the parent.
Vue.component('child-component', {
template: '<div class="child">{{testData}}</div>',
props: ['testData'],
data: function () {
return {
val: this.testData
}
}
});
Thank you in advance for your help!
Fiddle link