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

Do useInterval and useTimeout re-initialize on every re-render? #9

Open
vfonic opened this issue Feb 20, 2019 · 7 comments
Open

Do useInterval and useTimeout re-initialize on every re-render? #9

vfonic opened this issue Feb 20, 2019 · 7 comments

Comments

@vfonic
Copy link

vfonic commented Feb 20, 2019

I'm not sure if something changed in the API for useEffect, but I think that, if you omit the second argument, it will re-run the effect on every re-render.

@dispix
Copy link
Owner

dispix commented Feb 20, 2019

Well, given a recent article from Dan Abramov I think the current hooks need to be updated in order to be performant.

@vfonic
Copy link
Author

vfonic commented Feb 20, 2019

@dispix when you say "the current hooks" do you mean the hooks in this repo or the React hooks API?

It would be great to have some kind of notice or warning on the repo. Otherwise it seems like the repo is actively maintained, as the last change was about 2 months ago.

@dispix
Copy link
Owner

dispix commented Feb 20, 2019

The version 1.3.0 provides the updated hooks. Keep in mind that 2 months without an update for something as new as hooks is a very, very long time. I wasn't planning on actively maintaining this repository unless it is used, in which case I will definitely put the time and effort required. It just seemed to me that it didn't got enough attention.

@vfonic
Copy link
Author

vfonic commented Feb 20, 2019

You're right, two months is a long time. I've found your repo through one of the "awesome-react-hooks" repos and at first thought it's maintained, since it's there. Then I figured that useInterval doesn't work as expected. :/

Don't maintain the repo because of me. I've copy-pasted most of the hooks to my own repo.

@skipjack
Copy link

Nooooo, this repo's awesome! Can't force you to maintain it but I'd be happy to help if it makes a difference. I think it'll get more attention as people start to adopt hooks more.

@dispix
Copy link
Owner

dispix commented Mar 22, 2019

@skipjack Well honestly I'm really glad you think so 😃 I mean if at least one person likes it then I'd be glad to maintain it ! But your help would be welcome of course.

@skipjack
Copy link

skipjack commented Mar 22, 2019

I mean if at least one person likes it then I'd be glad to maintain it!

Lol I appreciate that but I'm fully aware how time consuming open source can be, so don't maintain just for my sake. I guess my point is just give it some time, I think this package will get more traction.

I came across it through awesome-react-hooks as well but I did probe a lot of other packages for lifecycle recipes and this one seemed best. I can't imagine that other people who are going more stateless/functional wouldn't be out looking for something like this. Plus... I mean come on... the package name is perfect 😜

I'll stop spamming @vfonic's issue though, just saw the conversation above and figured I'd chime in with an upvote.

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

3 participants