The Timer component utilizes react-timer-hook to manage a countdown timer. The issue occurs when pausing the timer using the provided pause button. Despite visually appearing paused, the internal timer continues to count down, resulting in incorrect time tracking.
The Timer component utilizes react-timer-hook to manage a countdown timer. The issue occurs when pausing the timer using the provided pause button. Despite visually appearing paused, the internal timer continues to count down, resulting in incorrect time tracking.
`const { time, correctMode, onTimeExpired, onStopTime, setTimeLeft } = props; const expiryTimestamp = new Date(Date.now() + time); const { seconds, minutes, hours, pause, resume, isRunning } = useTimer({ expiryTimestamp, onExpire: () => { onTimeExpired(); onStopTime(); },
}); const [expanded, setExpanded] = useState(true);
const togglePause = () => { isRunning ? pause() : resume() }
useEffect(() => { setTimeLeft((3600000 hours) + (60000 minutes) + (1000 * seconds)) }, [seconds, minutes, hours]);`