useLayoutEffect runs after DOM mutations but before the browser paints, which makes it useful for layout measurement and immediate visual correction.