useLayoutEffect

Learn how to read layout from the DOM and synchronously re-render.

What is the useLayoutEffect() method?

We briefly mentioned useLayoutEffect() when we presented useEffect(). It follows a similar pattern as the useEffect() Hook but differs in the timing of its execution and its synchronous nature.

While useEffect() is executed with a little bit of delay after the layout and paint phase of the browser, useLayoutEffect() is executed after layout but ...