State lives in React, filed under a position
The common read: my component owns its state, so what identifies that state is the component itself, and React hands it back whenever that component turns up again
Something keeps handing your component its state back, render after render. Where does it live, and what is it filed under? Not in your component: your function does not own its state. React holds it and files each piece under the position you already have from lesson 1, so retention is a function of that address, the component type sitting there, and time. Nothing else.
Replace every prop a component has in one render, and the state it was holding is
Takeaway: React runs a coat check: it keeps the coat, and the ticket is the position, not your name.
React discards what a position was holding the moment nothing renders there anymore, immediately and with no stash to recover it from. Two documented ways carry a value past that point anyway, by refusing to let the position disappear at all:
leave the node mounted and hide it with CSS lift the value into the parent
That is why the review panel still shows the last candidate's rating after you switch candidates: the fetch returned correctly, the component just never lost its position. Same type, same position, same stored state, and the new props arrive at a component that never lost anything.
