Skip to content
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

2023-08-09-effects-run-paint/ #5

Open
utterances-bot opened this issue Sep 19, 2023 · 4 comments
Open

2023-08-09-effects-run-paint/ #5

utterances-bot opened this issue Sep 19, 2023 · 4 comments

Comments

@utterances-bot
Copy link

When do useEffect() callbacks get run? Before paint or after paint?

Most of time useEffect() callbacks are run after paint but some time before paint.

https://jser.dev/2023-08-09-effects-run-paint/

Copy link

sk16 commented Sep 19, 2023

Great analysis. This explains why I have this bug : https://stackoverflow.com/questions/76422864/troubleshooting-progress-bar-transition-issue-in-react-code

@JSerZANP
Copy link
Owner

JSerZANP commented Nov 3, 2023

@sk16 thx! glad I could help

Copy link

slyxh2 commented Dec 28, 2023

Hi, the article is great! But for demo 1, I tried it in my local environment in React v18.2.0, the console result is 1 3 4 2. I do not know why I got the different result compared with codesandbox. And in the codesandbox, I open the native chrome console, the result is also 1 3 4 2. It's so wired...

@JSerZANP
Copy link
Owner

JSerZANP commented Mar 19, 2024

@slyxh2

interesting, I cannot reproduce with your result. Could you help find out why?
the reason why I gest 1 2 3 4 is explained in section 3 I'm guessing it is because of different browser or machine spec? 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants