P4.3: Passing Props & Destructuring

Props (properties) allow parent components to pass read-only parameters to child components.


1. Passing Props

function UserCard(props) {
  return <h2>Hello, {props.name}</h2>;
}

// Usage
<UserCard name="Rohan" />

🎓 Practice Assignment Tasks

  • Create a `ProductCard` component.
  • Pass it name, price, and description props and display them.
Stuck? Hints available
<!-- Write your HTML structure here to complete the assignment -->
🔒 Code requirements not met yet. Complete the tasks above.
🔒 Complete the Practice Assignment above to unlock completion.
Advertisement
NS
Ask Nextsem
AI Mode
NS
Home
Course
Playground