Props in React
Props are the input values a component receives. They help one component show different content in different places without rewriting the component each time.
Core Explanation
Props are the input values a component receives. They help one component show different content in different places without rewriting the component each time.
Props also help build a clear top-down data flow, which is one of the reasons React apps are easier to reason about than more chaotic DOM scripts.
Worked Examples
Use the examples below to connect the theory with syntax. The first example shows the basic pattern. The second moves closer to how the idea often appears in real applications.
Example A
function Welcome(props) {
return <h1>Hello, {props.name}</h1>;
}Example B
function Student({ name, course }) {
return <p>{name} studies {course}.</p>;
}Try changing variable names, labels, values, or returned JSX in each example. Even a small change helps you understand the pattern more deeply.
Mini Simulation
Prop Switcher
Change the prop value to see the output change without rewriting the component.
How It Fits Into a Real App
React concepts become more useful when you connect them to actual application design. For example, a dashboard might combine reusable components, state, events, conditional rendering, and API fetching all on one screen. A learning portal may add routing, validation, shared state, and persistence on top of that.
This lesson should therefore be thought of as part of a larger React workflow. The goal is not just to memorize syntax, but to understand when this concept helps make the interface clearer, more interactive, or more maintainable.
Lesson Summary
By the end of this lesson, you should be able to recognize the role of Props in React, read common examples confidently, and adapt the pattern into a small practice component of your own.
Exercises
- Practice task 1 for Props in React.
- Practice task 2 for Props in React.
- Practice task 3 for Props in React.
- Practice task 4 for Props in React.
- Practice task 5 for Props in React.
Practice before moving on
Rebuild one of the examples from memory, then modify it slightly. That is one of the fastest ways to turn recognition into working skill.