Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardReactuseEffect vs useLayoutEffect timingSingle-choice MCQ

Consider this code. What does the user observe on screen during the very first frame, and why?

function Box() { const [w, setW] = useState(0); useLayoutEffect(() => { setW(200); }, []); return <div style={{ width: w }}>hi</div>; }