REACT Tutorial



PROPS IN REACT


Props in React

Props (short for properties) are inputs to React components. They allow you to pass data from a parent component to a child component, making your UI dynamic and reusable.

How Props Work

Think of props as arguments you pass to a function. Inside the child component, you can access props via the props object.

function Greet(props) {
  return <h3>Hello, {props.name}!</h3>;
}

function App() {
  return (
    <Greet name="Aanya" />
  );
}

In this example, the Greet component receives the prop name from App and uses it to display a personalized greeting.

Props are Read-Only

Remember, props are immutable. A component must never change its own props — it should only use them to render content.

Tip: Use props to create reusable and customizable components that adapt to different data.

🌟 Enjoyed Learning with Us?

Help others discover Technorank Learning by sharing your honest experience.
Your support inspires us to keep building!

Leave a Google Review