What are props and state? How are they different?
Understand the difference between props and state in React — one for data input, the other for dynamic data changes.
beginnerState lifecyclereactpropsstatedata flow
Published: Oct 26, 2025
Advertisement
React uses props and state to manage data flow within applications.
🧩 Props
- Short for properties.
- Passed from parent → child.
- Immutable inside the child component.
function Welcome({ name }) {
return <h2>Hello {name}</h2>;
}
⚙️ State
- Internal data managed by the component.
- Can change over time with
setStateoruseState.
function Counter() {
const [count, setCount] = useState(0);
return <button onClick={() => setCount(count + 1)}>{count}</button>;
}
✅ Difference Summary
| Feature | Props | State |
|---|---|---|
| Data Source | Parent | Component itself |
| Mutability | Immutable | Mutable |
| Usage | Pass data | Manage local changes |
Frequently Asked Questions
Can a component modify its props?
No, props are immutable. Only parent components can change them.
Advertisement
Stay Updated
Get the latest frontend challenges, interview questions and tutorials delivered to your inbox.
Advertisement