Last active
February 27, 2019 09:28
-
-
Save phsantiago/aa33c8a98e40dc79220245e6ac157bb7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Metronomo extends React.Component { | |
componentDidMount() { | |
this.primeiroContador = setInterval( | |
() => this.contagem(), | |
1000 | |
); | |
this.segundoContador = setInterval( | |
() => this.contagem(), | |
500 | |
); | |
this.terceiroContador = setInterval( | |
() => this.contagem(), | |
150 | |
); | |
} | |
componentWillUnmount() { | |
clearInterval(this.primeiroContador); | |
clearInterval(this.segundoContador); | |
clearInterval(this.terceiroContador); | |
} | |
contagem() { | |
/* ... */ | |
} | |
render() { | |
/* ... */ | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment