useEffect sometimes fires before paint

from blog Vladimir Klepov as a Coder, | ↗ original
useEffect should run after paint to prevent blocking the update. But did you know it's not really guaranteed to fire after paint? Updating state in useLayoutEffect makes every useEffect from the same render run before paint, effectively turning them into layout effects. Confusing? Let me explain. In a normal flow, react updates go like this:...