In React, props (short for properties) allow you to pass data from a parent component to a child component. Itβs one of the most important concepts that makes components reusable and dynamic.
π Example:
function Welcome(props) {
return <h1>Hello, {props.name}</h1>;
}
Used like this:
<Welcome name="Aman" />
π Key points:
β’ Props are read-only
β’ You can pass strings, numbers, arrays, functions, or even JSX
β’ Helps build modular UI by customizing each instance of a component
π‘ Bonus tip: Use destructuring for cleaner code
function Welcome({ name }) {
return <h1>Hello, {name}</h1>;
}
Mastering props is your first step toward building clean and scalable React apps.
Top comments (0)