setState in a function in component

I’ve done the binding in constructor, and the console.log’s post ok. But error = cannot read properties of undefined in the setState expression.
I’m getting same issue a lot trying variations and been struggling a bit.

link to full code (but was hoping someone knows issue without looking too deep):
(will try not to edit for a while and have a break)

  timerCount() {

    const id = setInterval(countDown(this.state.secCount), 1000);
    function countDown(secs) {
      if (secs <= 0) { return( clearInterval(id) ) }
      else {
            secCount: secs-1,
  render() {


Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36

Challenge: Build a 25 + 5 Clock

Link to the challenge:

plus: I’ve had a few infinite loops as a result of state not passing in properly (or whatever it is). Isn’t there some emergency ‘break’ button for stopping this? Or is it just too nooby to bother?

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.