react-compound-timer
react-compound-timer copied to clipboard
Reset timer inside checkpoint
I need to reset the timer when it reaches 0 if some condition happens. Ex:
<Timer
initialTime={15000}
direction="backward"
checkpoints={[
{
time: 0,
callback: () => {
if (someConidition) // Reset Timer Here
},
},
]}
>
{({ start, resume, pause, stop, reset, timerState }) => (
<React.Fragment>
...
</React.Fragment>
)}
</Timer>
I don't such functionality in the documentation, as the reset function is only accessible inside the body of the component. Any workarounds for this, please?