juniorVue.js
How do you emit events from a child to a parent?
Updated May 4, 2026
Short answer
Use the $emit method (Options API) or emit function (Composition API) to trigger custom events.
Deep explanation
Since props are one-way, children communicate back to parents via events. The child 'emits' an event with a name and optional payload, and the parent listens for it using v-on or @.
Real-world example
A 'Close' button in a Modal component notifying the Parent to set showModal = false.
Common mistakes
- Using camelCase for event names in the template (Kebab-case is standard for DOM event listeners).
Follow-up questions
- Can you pass multiple arguments in an emit?