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

react-timer-mixin #38

Open
ziven27 opened this issue Sep 8, 2019 · 0 comments
Open

react-timer-mixin #38

ziven27 opened this issue Sep 8, 2019 · 0 comments
Assignees

Comments

@ziven27
Copy link
Contributor

ziven27 commented Sep 8, 2019

  • npm
  • GitHub stars

描述

Using bare setTimeout, setInterval, setImmediate and requestAnimationFrame calls is very dangerous because if you forget to cancel the request before the component is unmounted, you risk the callback throwing an exception.

If you include TimerMixin, then you can replace your calls to setTimeout(fn, 500) with this.setTimeout(fn, 500) (just prepend this.) and everything will be properly cleaned up for you.

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

No branches or pull requests

1 participant