Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

kevbrn's avatar
Level 14

Reload parent data on child save/update

I'm loading a parent component with user data from the controller. The parent component has a child component for adding a new user, everything works as expected and now I want the parent component's data to re-actively show the newly added user once the post request to axios is complete. I assume this will be achieved with an $emit that triggers a method on the parent to "refresh" the axios.get ? Would this be the right approach?

0 likes
4 replies
rawilk's avatar

That's the way I usually do it is to emit an event from the child to the parent component.

1 like
rawilk's avatar
rawilk
Best Answer
Level 47

In your child:


someMethod () {
    this.$emit('event-name');
}

In the parent:


<child-component
    @event-name="handleChildEvent"
>
</child-component>

...

handleChildEvent () {
    // do what you need here
}

2 likes

Please or to participate in this conversation.