How do you send data from parent to child component in React?
Understand how to pass props from parent to child components in React using JSX attributes.
Question
How do you send data from parent to child component in React?
Answer
You use props — short for “properties.”
Props are how data flows downward in React.
function Child({ name }) {
return <h3>Hello, {name}!</h3>;
}
function Parent() {
return <Child name='Ghazi' />;
}
Here, name is passed as a prop from Parent → Child.
Props are read-only in the child. If the child needs to change something, it must ask the parent via a callback (we’ll cover that later).
Real-World Example
Passing data like:
userobject to Profile componentsthemevalues to Button or Layout- config props to reusable UI blocks
Quick Practice
Create a parent that passes a user object to a UserCard component and display name, email, and role.
Summary
Props are the data bridge between parent and child components in React.
Can props be changed by the child?
No, props are read-only inside the child component.
Can I pass a function as a prop?
Yes, functions are first-class citizens in JS. You can pass and call them like normal data.
Stay Updated
Get the latest frontend challenges, interview questions and tutorials delivered to your inbox.