State is local to its component, and each copy of the component gets its own. It is mutable in the sense that it changes over time, but you never modify it directly. You call the setter, like setCount, and React re-renders with the new value.
Rewriting in plainer words…
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
If a click handler calls setCount(count + 1) twice, what does count end up as, and why?Both calls read the same count from this render, so it goes up by 1. The updater form setCount(c => c + 1) builds on the latest queued value.
Why not change an object in state directly, like user.name = 'Sam', and then call the setter?React compares old and new values with Object.is. A mutated object keeps its reference, so React may skip the render. Pass a new copy instead.
Two sibling components need the same piece of state. Where should it live?Move it to their closest common parent, then pass the value and the setter down as props.
Should you keep a value in state if you can compute it from props or other state?No. Compute it during render. A second copy in state can drift out of sync with its source and needs extra updates to stay correct.
What you can say
State is data React keeps for a component that can change over time, and when it changes, React re-renders that component.
In a function component I get it from useState, which gives me the current value and a setter, like count and setCount starting at zero.
When the user clicks, I call setCount(count + 1), and React re-renders the component with the new count.
I never assign to the state variable myself. The setter is how React finds out something changed.
State is local, so each copy of the component keeps its own value. If two components need the same data, I lift the state up to a common parent.
Weak answers to avoid
Mutates state directlycount++ or pushing into a state array skips the setter, so React has no reason to re-render. Say you always call the setter with a new value.
Blurs state and propsProps come from the parent and the child doesn't change them. Keep them apart. State is data the component owns and updates through its setter.
Treats state as shared or globalEach rendered copy of a component has its own state, so two Counters count separately. Sharing a value means lifting state up or using Context.
Expects the new value right after the setterReading count on the line after setCount still gives the old value. The new value shows up on the next render, which is why the updater form exists.
Interview lens
Likely follow-ups, what you can say, and the weak answers to avoid.