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.
PreviousAn infinite scroll list keeps adding listeners and slows over time. How do you debug it?Next What does useId solve?