React card revieweasy
What is the difference between State and Props in React?
Props and State are both used to manage data in React.
Props:
- Passed from parent to child component
- Read-only
- Cannot be modified by child component
State:
- Managed within a component
- Mutable
- Can be updated using setState or useState
Example: Props = Data received from parent. State = Data managed inside component.