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

custom-useEffect hook does not function like useEffect. #9

Open
kobbin003 opened this issue Aug 21, 2024 · 0 comments
Open

custom-useEffect hook does not function like useEffect. #9

kobbin003 opened this issue Aug 21, 2024 · 0 comments

Comments

@kobbin003
Copy link

In useEffect, when there is an update of state, the cleanup function of old state runs and then the callback function of the updated state runs.
In your code, when there is an update of state, the callback function of the updated state runs and then the cleanup function of updated state runs. The cleanup runs same as callback.

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

1 participant