I have finished writing the functional part of the code. It seems that I am using useEffect, useState and setInterval together in a wrong way. The problem: my clock starts with a 2 second interval. After that it continues with the intended 1 sec interval. Same thing happens when I pause/start my clock. So it happens when I set the endTime to base my calculation of remaining time.
Here is the link for working code https://codesandbox.io/s/jovial-cloud-9nd46?file=/clock.js
Any advice on where my logic got derailed is appreciated. Also any other advice on how to make the code more clean “react”