...

/

Communication with the Parent Component

Communication with the Parent Component

Learn about emits and slots used for communication with parent components in Vue.

We'll cover the following...

Overview

So far, we’ve seen how to get data into a component using props, but how do we allow our component to communicate information back? In React, it’s common to pass a callback functionA callback function is a function that is passed as an argument to another function and is executed after the completion of that function's task. to a component to allow for data to be sent back. Although it’s also possible to do this in Vue, the preferred way is to use events.

We can listen to the DOM events (such as mouse clicks) on HTML elements in the template and connect them up to handler methods. It’s actually ...