25 + 5 clock not reading 00:00 to pass

I have a Codepen for the task and it reaches 00:00 yet the test says it fails?

in console count logs twice for each except for “0 and 59”, do you find this acceptable as per your implementation?

also i noticed you’re using a callback state updater but later on using “direct” state reference, what if you changed that to only using callback value instead?

this.setState((prevState) => ({
      [type]: prevState[type] + 1,
    }), () => {
      // This code will run after the state update is complete.
      if (type === "sessionLength") {
        console.log(this.state.startSessionLength, this.state.sessionLength);
        // here
        this.setState({ startSessionLength: this.state.sessionLength });

happy coding :slight_smile:

2 Likes

Thanks, I have changed it to a callback value instead. I just don’t understand where I am going wrong eveything seems to work fine.

  • did you try to figure this out why is that happening?
  • it can be a bit frustrating at times but i will say take on one step at a time and solve them iteratively

happy coding :slight_smile:

But isn’t this just due to the console logs? I fixed the start button from being pressed multiple times and now added the HTML audio element.

okay i fixed two more test cases just by changing id name to “appropriately” and few more can also be solved if you change this by reading through error messages given for “timer” section

<h1 className="looks"><span id="start_stop" onClick={() => this.btnstart()}>Start </span><span onClick={() => this.stop()}>Stop </span><span id="reset" onClick={() => this.reset('')}>Reset</span></h1>
  • try using only “two buttons” instead of three, seems like this is what test case “10 and 11” is talking about
  • adjust this snippet further to reflect those changes and keep building up on that

happy coding :slight_smile:

1 Like

ah thank you, the issue seemed to be with the ID labelled incorrect. Cheers!

1 Like

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