Why is the timer not working?

I am writing a final test on Front End Development Libraries and the interval function does not work for me. can anyone suggest what is wrong?

Log out this.state.isCounting and this.state.timeleft inside the interval method.


  1. Is a timing issue. You can use the setState callback to invoke interval although it probably isn’t the correct, or best way of dealing with it.
this.setState(
  (state) => ({ isCounting: !state.isCounting }),
  () => {
    this.interval();
  }
);
  1. Is a typo (camelCase variable).

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