mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
0e51ebf78fd97a4bf4681967f80e730f7ff2e779
@stipsan found this issue where the compiler would bailout on the
`useLayoutEffect` examples in the React docs. While setState in an
effect is typically an anti-pattern due to the fact that it hurts
performance through cascading renders, the one scenario where it _is_
allowed is if the value being set flows from a ref.
DiffTrain build for [835b00908b](https://github.com/facebook/react/commit/835b00908b1b1c522323162b735a85c5f620ac81)
[compiler] Allow setStates in use{Layout,Insertion}Effect where the set value is derived from a ref (#34462)
react-fbsource-import
Languages
JavaScript
67.1%
TypeScript
29.4%
HTML
1.5%
CSS
1.1%
C++
0.6%
Other
0.2%