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 pricing

Real-world example

No real-world example available yet.

Unlock with a Pro subscription to view this section.

Upgrade to Pro

Common mistakes

No common mistakes listed yet.

Unlock with a Pro subscription to view this section.

Upgrade to Pro

Follow-up questions

No follow-up questions available yet.

Unlock with a Pro subscription to view this section.

Upgrade to Pro

More React interview questions

View all →