QuizNot attempted
Three setCount(count + 1) in one click
1–4 to choose, Enter to submit
Show answer & explanation
Correct answer:
- Shows
1, logs twice
- All three calls read the same render's
count(0), so each queues 'set to 1', and React batches the event's updates into one re-render: shows1, logs twice (mount + one update). - Not shows 3: that needs functional updates
c => c + 1. - Not logs 4 times: batching means one render per event, not one per
setCount.