S
S
Sergey Khlopov2019-08-28 16:18:30
Vue.js
Sergey Khlopov, 2019-08-28 16:18:30

Is it true that a child component changes the parent's state?

Hello, please tell me, I have a parent component that passes an array of categories to the child, and the child, in turn, removes elements from this array during certain actions, is this behavior correct? Or is it necessary to strictly use v-model on the child component in such situations? And to receive changes from the child component only when the event is dispatched. And of course, the child component has this:this.$emit('categories-updated',localCategories);

model: {
            prop: 'categories',
            event: 'categories-updated',
        },

Thank you in advance for your response.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Suha, 2019-08-28
@Shlop

Need to emit an event

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question