Props vs state: what is the difference?
Practice this questionWANT TO UNDERSTAND THE CONCEPT FIRST?Learn Props & state
Definition:
Props are values a parent supplies to a component, while state is data React remembers for a component across renders. Both influence the UI, but a component should not change its received props directly. State updates request a new render so the screen can reflect the new data.
Key points:
-
Props are inputs from a parent; treat them as read-only.
-
State is component data that can change over time.
-
Lift shared state to the nearest common parent when needed.
-
Use one clear owner for shared data; copying the same prop into local state without a synchronization rule often creates stale values.
Interview point:
- Explain who owns the data and who is allowed to request a change, rather than only saying props are external and state is internal.
Adapted from 06_REACT_NEXTJS.md · “Props vs state: what is the difference?”. Code examples are study fragments. Difficulty and core labels are editorial estimates; version-specific behavior should be checked against your project.