Skip to content

MediumConceptReact patterns and rendering

What is the difference between useLayoutEffect and useEffect?

What a good answer covers

useLayoutEffect runs synchronously after DOM updates but before the browser paints, so use it for measuring and adjusting layout. useEffect runs after paint and is right for most side effects.

More on React patterns and rendering

Flashcards for this topic