Skip to content

Commit c4555ca

Browse files
committed
enhancement setIsRunning to false only from clearIntervalRef
1 parent 02b5de1 commit c4555ca

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/useTimer.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ export default function useTimer(settings) {
1010

1111
function clearIntervalRef() {
1212
if (intervalRef.current) {
13+
setIsRunning(false);
1314
clearInterval(intervalRef.current);
1415
intervalRef.current = undefined;
1516
}
1617
}
1718

1819
function handleExpire() {
1920
clearIntervalRef();
20-
setIsRunning(false);
2121
Validate.onExpire(onExpire) && onExpire();
2222
}
2323

@@ -35,7 +35,6 @@ export default function useTimer(settings) {
3535
}
3636

3737
function pause() {
38-
setIsRunning(false);
3938
clearIntervalRef();
4039
}
4140

0 commit comments

Comments
 (0)