Props Basics
Props (short for "properties") are how you pass data from a parent component to a child component. They make components reusable and dynamic.
What are Props?
Props are arguments passed to React components. They're like function parameters:
Loading React playground...
Passing Props
In real React JSX, props look like HTML attributes:
Loading React playground...
Destructuring Props
A cleaner way to access props is through destructuring:
Loading React playground...
Default Props
You can provide default values for props:
Loading React playground...
Exercise: Basic Props
Loading exercise...
Exercise: Destructured Props with Defaults
Loading exercise...
Props are Read-Only
Loading React playground...
Key Takeaways
- Props are function arguments - Passed as an object to components
- Any value type - Strings, numbers, booleans, arrays, objects, functions
- Destructuring is cleaner -
function Card({ name, age })is preferred - Default values - Use
= valuein destructuring for defaults - Props are read-only - Never modify props directly

