React setState doesn't seem to work some times

I am working on Front End Libraries Projects - Build a Pomodoro Clock.

I have pretty much implemented the functionality. But one major bug is there which I am unable to understand how it is getting caused.

Codepen: https://codepen.io/abhi747/pen/eYZNbpb?editors=0010

As per the requirement, the break and session timers are needed to be run in a loop in one after another sequence. When I start the timer, it correctly starts the timer in session mode and on end of the session timer, break timer starts as expected.

But when the break timer ends, session timer does not starts back. The break timer starts again.

I have created a state - isSessionMode which stores a boolean value for mode - either session or break, true by default.

Then on end of timer, I have checked if isSessionMode is true, the set timer according to the break length and set isSessionMode false. Else, set the timer according to the session length and set isSessionMode true.

Hi, you need to read the error messages on your codePen project, they give you the answer on what to fix or add.

I would finish all the easy fixes, then see where you are at.