Skip to content

Commit

Permalink
Use callback for countdown reset
Browse files Browse the repository at this point in the history
  • Loading branch information
gromchen committed May 30, 2023
1 parent 4c1ad0c commit a196cdc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/useCountdown/useCountdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,10 @@ function useCountdown(
/**
* Will set running false and reset the seconds to initial value
*/
const resetCountdown = () => {
const resetCountdown = useCallback(() => {
stopCountdown()
resetCounter()
}
}, [resetCounter, stopCountdown])

const countdownCallback = useCallback(() => {
if (count === countStop) {
Expand Down

0 comments on commit a196cdc

Please sign in to comment.