reactjs / react-timer-mixin

TimerMixin provides timer functions for executing code in the future that are safely cleaned up when the component unmounts

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Why is this necessary?

wle8300 opened this issue · comments

commented

Can't you just use a private variable on the component for your timers, and then use the lifecycle method, componentWillUnmount, to clear appropriate "timeouts" and "intervals"?

This mixin is uses more power than it needs to. This use case could be solved simply by using a documented & official lifecycle method.

Yes. This makes it harder to forget. What you suggest certainly works and is the approach I usually use.