What is the difference between useEffect and useLayoutEffect?
Answer
•useEffect runs after the browser paints.
•useLayoutEffect runs synchronously after DOM mutations, before painting.
•useLayoutEffect can block rendering.
•Use it for measurements/UI flickering.
•In most cases, useEffect is sufficient.
Was this answer helpful?