As far as I understand it, useLayoutEffect runs synchronously, while useEffect asynchronously - more or less as if we used useLayoutEffect, but with setTimeout(func,0).
useLayoutEffect is meant to be used "whenever the effect's changing how the website looks". Therefore, I assume I should use it if, for example, the effect changes some state that's then later displayed to the user.
However, setState itself is asynchronous, which seems to defeat the synchronous purpose of useLayoutEffect - the UI change will be reflected in the DOM only in the next tick (unless we mutate the DOM directly, in an non-Reactish way).
What do I not understand correctly?