Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardReactworker threadsSingle-choice MCQ

A worker computes results and posts them back. Why does naively calling `setState` for each message often hurt performance, and what is the threading/scheduling reason?

worker.onmessage = (e) => { setResults((prev) => [...prev, e.data]); };