useLayoutEffect is a bad place for deriving state

from blog Vladimir Klepov as a Coder, | ↗ original
Today we'll talk about updating state inside useLayoutEffect in reaction to prop changes. Will it work? Is it safe? Are there better ways to implement such state changes? TLDR: it works, but leaves you with an extra DOM update that may break stuff. As we all know, useLayoutEffect is called before the browser has painted the DOM. This might lead...