CHAPTER 07
Beginner
Props and Component Communication
Updated: May 18, 2026
5 min read
# CHAPTER 7
Props and Component Communication
1. Chapter Introduction
Components need to talk to each other. Vue uses a "one-way data flow" architecture: data flows DOWN via props, events flow UP via$emit. This predictable pattern makes debugging easy — you always know where data comes from.
2. Learning Objectives
-
Pass data from parent to child with
defineProps.
-
Emit events from child to parent with
defineEmits.
- Validate props with type checking and required flags.
-
Use
v-modelon custom components.
3. Props (Parent → Child)
vue
vue
4. Emitting Events (Child → Parent)
vue
vue
5. Custom v-model on Components
vue
vue
6. Prop Validation Summary
javascript
7. Common Mistakes
-
Mutating props directly:
props.name = 'Bob'is wrong and causes Vue warnings. Props are read-only. Emit an event to ask the parent to change data.
-
Wrong prop name casing: In template, props passed as
:user-namemust be declared asuserName(camelCase) indefineProps. Vue auto-converts kebab-case to camelCase.
8. MCQs
Question 1
How does data flow in Vue components?
Question 2
defineProps is used in?
Question 3
Can you mutate a prop directly?
Question 4
How do you emit an event from a child?
Question 5
v-model on a custom component requires?
Question 6
Array prop default must be?
Question 7
v-bind="obj" on a component?
Question 8
Prop validator function returns?
Question 9
PropTypes in Vue are defined using?
Question 10
emit('change', value) in child is listened in parent with?
9. Interview Questions
- Q: Why is direct prop mutation an anti-pattern in Vue?
- Q: How do you implement v-model on a custom component in Vue 3?
10. Summary
Vue's component communication is one-directional and predictable. Props carry data DOWN from parent to child.defineEmits carries events UP from child to parent. Custom v-model combines both for a clean two-way binding API on form-like components. Always treat props as read-only.
11. Next Chapter Recommendation
In Chapter 8: Directives in Vue.js, we master all of Vue's built-in directives —v-bind, v-model, v-if, v-show, v-for — and create custom directives for DOM behavior.