Roast topics
Find topics
Roast it!
Roast topics
Find topics
Find it!
Login
From:
Vladimir Klepov as a Coder
(Uncensored)
subscribe
useLayoutEffect is a bad place for deriving state
https://thoughtspile.github.io/2021/09/21/useeffect-derived-state/
links
backlinks
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.