Description

A review panel shows a prompt and lets users open a writing form by clicking a button. Clicking Write Review causes the component area to go blank with no recovery.

Anomaly

Clicking Write Review causes the component area to go blank. No form appears.

Constraint
Do not split the component into two separate components
The fix must be a single-line relocation - nothing else changes
Hint
Consult the SenseiOnly for those truly stuck · Flip to reveal

Consider whether everything in this component runs on every render, or only sometimes.

Loading editor…
Correct Solution
Loading...

Why this fixes it

On the first render reviewing was false, the if block was skipped, and React registered one hook. When the click set reviewing to true, the next render encountered two useState calls instead of one. React associates state with hooks by call order - the index in its internal fiber array is the only identifier - so a change in hook count between renders is unrecoverable. React throws immediately. Moving const [charCount, setCharCount] = useState(0) above the if block means it always executes. The value is simply unused in the non-reviewing branch, which is harmless.

Expected OutputGoal State
Your OutputLive