use-timer
use-timer copied to clipboard
Timer callbacks
onTimeUpdate wrong triggering time
onTimeUpdate
function is called on component mount. I think it should be called ONLY when timer status
is 'RUNNING'.
Otherwise there should be some checks like:
onTimeUpdate: () => {
if (timerName.status === 'STOPPED') return;
...code
},
Good callback fn to add
- onTimeReset
- onTimePause
- onTimeStop
- onTimeStart