Props (short for properties) are used to pass data from one component to another. They allow components to be dynamic and reusable.
Props are read-only
Passed from parent to child
Used to customize components
Usage:
Reuse components with different data
Keep components flexible
Separate logic and UI
Strings → "text"
Numbers / booleans → {}
Instead of:
Use:
Provide default values if props are missing.
❌ Incorrect:
✅ Correct:
Props should never be modified
Use state if data needs to change
Usage:
| Props | State |
|---|---|
| Passed from parent | Managed inside component |
| Read-only | Can be updated |
| Makes components reusable | Manages dynamic data |
Props pass data to components
They are immutable
Destructuring improves readability
children is a special prop
Take quizzes related to this topic and see where you stand!
Start Quiz Now