In the pseudocode below, I have a parent component that has initial data of name and ages and I am passing them as props to child-component.
My child-component is taking them as props but what if I want to mutate the props. For example, say I want to reverse the name prop string. Or if I want to pop() the last age of the ages array? Do I have to set those props to initial data in the child component?
Parent
<template>
<child-component :name=name :ages=ages></child-component>
</template>
data() {
return {
name: "Alex",
ages: [23,41,94],
}
}
Child
props: {
name: {type: String},
ages: {type: Array},
}