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

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 setState or useState.
function Counter() {
  const [count, setCount] = useState(0);
  return <button onClick={() => setCount(count + 1)}>{count}</button>;
}

✅ Difference Summary

FeaturePropsState
Data SourceParentComponent itself
MutabilityImmutableMutable
UsagePass dataManage 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