-
-
Save Eliav2/37ea7b31be049290bcce13ee31e1278e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const EffectVsLayoutEffect = () => { | |
const logUseLayoutEffect = useLog("useLayoutEffect", useLayoutEffect); | |
const logUseEffect = useLog("useEffect", useEffect); | |
useEffect(() => { | |
logUseEffect("boom!"); | |
}); | |
useLayoutEffect(() => { | |
logUseLayoutEffect("boom!"); | |
}); | |
return <div />; | |
/** | |
* expected logs: | |
* boom! {call:1,render:1}(useLayoutEffect) in 4.21ms | |
* boom! {call:1,render:1}(useEffect) in 13.37ms | |
*/ | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment