React · Frontend system thinking
What is the difference between props and state?
Short answer
Props are read-only inputs passed from a parent. State is data a component owns and can change, and changing it schedules a re-render.
Props flow down the tree. A child should treat them as immutable and ask the parent to change them through a callback. State is local to a component instance and is the component's memory across renders.
function Counter({ label }) {
const [count, setCount] = useState(0);
return (
<button onClick={() => setCount(count + 1)}>
{label}: {count}
</button>
);
}label is a prop. count is state owned by Counter.The differences
- Props are passed in; state is declared inside the component
- Props are read-only; state is updated with a setter
- A prop change re-renders the child; a state change re-renders the component that owns it
- State persists across renders until the component unmounts or the state changes
If two components need the same data, move it to their closest common parent and pass it down. That is lifting state up. If many distant components need it, context or an external store may be appropriate.
Follow-ups you should expect
Interviewers use these to check whether the first answer was understanding or memorisation.
- 1Can a child component change its props?
- 2What happens when a prop changes?
- 3When should state be lifted?
- 4Why is copying props into state usually a mistake?
Say it in the interview
Props are read-only inputs from a parent. State is data the component owns and can update, and updating it triggers a re-render. Props flow down and children request changes through callbacks. If several components need the same state, I lift it to a common parent. I avoid copying props into state because that creates duplicate sources of truth.
Use this as a model, not a script. Saying it in your own words is what makes it survive follow-up pressure.
Related questions
Reading is step one
Now say it out loud.
Understanding an answer and delivering it under pressure are different skills. Rehearse this topic in a live React mock interview and get scored feedback on depth, clarity and confidence.