seniorReact
What is the difference between useLayoutEffect and useEffect?
Updated Apr 23, 2026
Short answer
useEffect runs after paint, while useLayoutEffect runs synchronously before the browser paints.
Deep explanation
useLayoutEffect blocks the browser from painting until it finishes, making it useful for DOM measurements and layout calculations. useEffect runs asynchronously after paint, making it better for side effects like API calls. Overusing useLayoutEffect can hurt performance by blocking rendering.
Unlock with a Pro subscription to view this section.
View pricingReal-world example
No real-world example available yet.
Unlock with a Pro subscription to view this section.
Upgrade to ProCommon mistakes
No common mistakes listed yet.
Unlock with a Pro subscription to view this section.
Upgrade to ProFollow-up questions
No follow-up questions available yet.
Unlock with a Pro subscription to view this section.
Upgrade to Pro