title: stop setInterval and if not work in react native function
body: <p>I have the code below:</p>
  
  <pre class="lang-js prettyprint-override"><code>contaTempo(){
    setInterval(() =&gt; this.setState({tempo: this.state.tempo+1}), 1000)
    if (this.state.tempo &gt;= 5) {
      this.props.navigation.navigate('Sobre')
    }
  }
  </code></pre>
  
  <p>The <code>setInterval</code> works correctly but the <code>if</code> doesn't work. Also, the timer neve stops. Any help?</p>