Closed jimkhan closed 3 years ago
=
i want to reset the unitl value how can I do it?? is there any solution? thanks in advance!
Do you have a solution?
Try this with new id it will reset the timer and it should be in string
<CountDown id={new Date().getTime().toString()}
more specifically how does it work? what do you do after adding that?
@BogdanGeorgian91 I just figured this out. Sorry I'm 8 months late.
To reset the timer, you must change the id
of the CountDown. In other words, if I set the id
to 1, updating the id
to 2 will reset the counter to whatever's in the until
prop.
I was able to add a "Reset Timer" button that would randomize the state of the id, so it would reset every time the button was pressed. I had the id saved using setState
, with a resetTimer
method that would set the id to a random number.
Let me know if that makes sense. It's not even mentioned in the docs.
i want to reset the unitl value how can I do it?? is there any solution? thanks in advance!