-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
useEffect or useLayoutEffect #40
Comments
Yeah, we should always prefer using useEffect.
I'm not sure as I don't look into the recent hookstate code. |
basically, a user interaction or network event CAN NOT TRIGGER any state change BEFORE useEffect is completed but AFTER dom drawing is completed? |
@dai-shi right or no? what do you think? |
for reference for the future: https://twitter.com/dai_shi/status/1227237850707447809 |
https://reactjs.org/docs/hooks-reference.html#useeffect
You can trigger state updates before effects, but it will not render. Note in CM, it can render multiple times before effect runs, so you can't reliably mutate variables in render functions. |
Nice thanks. It means I can boost the performance a little bit more |
Let's move the discussion about this topic from #14 (comment)
The text was updated successfully, but these errors were encountered: