Migration to v5
This is a rather small breaking update. There have been changes to useClock
’s pausing behaviour and useCounter
’s stopping behaviour.
Counters
The counter hooks useCounter
, useTimer
will now be reset to their starting values when being stopped by default. The countdown hook useCountdown
will not change, i.e. it will still not reset by default.
However, you can opt-out of this new behaviour by setting resetOnStop
. It’s available on all counter based hooks.
Additionally, all counter based hooks now receive a new control function called reset()
, to manually reset the counter whenever you wish.
// If you want to keep the v4 behaviour, use:
const [counter] = useTimer(0, { resetOnStop: false });
Clock update
By default, the clock will now keep running in the background when paused. This allows to show the correct time upon resuming.
This behaviour can be opted-out of by setting keepPausedClockRunningInBackground
to false
.