react-compound-timer icon indicating copy to clipboard operation
react-compound-timer copied to clipboard

Reset timer inside checkpoint

Open ahmedhammad97 opened this issue 4 years ago • 0 comments

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?

ahmedhammad97 avatar Jun 06 '21 13:06 ahmedhammad97