DEV Community

Aman Kureshi
Aman Kureshi

Posted on

πŸ“¦ Understanding props in React β€” The Key to Reusable Components

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)