title: How do i restart a timer after a clearInterval() in reactjs?
body: <p>So i have a timer, and when i use <code>clearInterval(this.temporizador)</code> the time stops. I want to restart the timer from 0 when i use <code>resetState()</code>, but its not working. What am i doing wrong? </p>
  
  <pre><code>componentWillMount() {
          console.log("DEBUG: componentWillMount");
          this.generateCardArray();
          this.shuffleFunction();
          this.temporizador = setInterval(() =&gt; {
            const { seconds, minutes } = this.state
            const timeformat = (minutes &lt; 10 ? "0" + minutes : minutes) + ":" + (seconds &lt; 10 ? "0" + seconds : seconds)
            if (seconds &lt; 59) {
              this.setState(({ seconds }) =&gt; ({
                seconds: seconds + 1
              }))
            }
  
            if (seconds === 59) {
                this.setState(({ minutes }) =&gt; ({
                  minutes: minutes + 1,
                  seconds: 0
                }))
  
            }
  
            if (minutes === 60){
            clearInterval(this.temporizador)
            alert("Time's up! Game is restarting")
            window.location.reload(true);}
  
            this.setState({time: timeformat })
          }, 1000)
  
        }
  
    resetState(){
      this.setState({
        cardArray: [],
        matchedcardArray: [],
        cardSelection:[],
        attempts: 0,
        seconds: 1,
        minutes: 0,
        time: "00:00" , 
        cardsMatched: 0,
        showEnd: false
      })
      this.generateCardArray();
      this.shuffleFunction();
      setInterval(this.temporizador,1000);
    }
  </code></pre>