Closed HendryVarianto14 closed 2 years ago
Nvm. i messed up
Can you share your complete code in a sandbox or something? I am having issues now.
Can you share your complete code in a sandbox or something? I am having issues now.
In my case, it does not reset when closing a modal.
Can you share your complete code in a sandbox or something? I am having issues now.
For me, i used useMemo (dont know if its a good practice to use useMemo like this) to store the time, it goes something like this:
const time = useMemo(() => { if (!reset) { return Date.now() + 60000; } else { return Date.now() + 60000; } }, [reset]);
So, every time i clicked the reset button, it changes the reset state, thus, the useMemo runs again and reapplied the time. It works, but you need to include autoStart to the props for the time to runs
Can you share your complete code in a sandbox or something? I am having issues now.
In my case, it does not reset when closing a modal.
I never tried it, but try to use the flag of the modal as the key of the Countdown LMK if this works
Can you share your complete code in a sandbox or something? I am having issues now.
In my case, it does not reset when closing a modal.
I never tried it, but try to use the flag of the modal as the key of the Countdown LMK if this works
which flag?
Can you share your complete code in a sandbox or something? I am having issues now.
In my case, it does not reset when closing a modal.
I never tried it, but try to use the flag of the modal as the key of the Countdown LMK if this works
which flag?
The Modal's flag. y'know, the open={flag}
Can you share your complete code in a sandbox or something? I am having issues now.
In my case, it does not reset when closing a modal.
I never tried it, but try to use the flag of the modal as the key of the Countdown LMK if this works
which flag?
The Modal's flag. y'know, the
open={flag}
I have to check it again.
Hello,
I tried to reset the time with changing the key whenever the timer completed. But, the timer did not reset at all.
it works when i used the timer in the modal, but failed when i do it in a single page.
<Countdown date={startDate.current + 5000} key={reset} onComplete={() => setReset(prev => prev + 1)} renderer={({ formatted, completed }) => { if (completed) { return ( <span className={classes.hyperlink} onClick={e => { e.preventDefault(); setReset(reset + 1); }}> ReSend </span> ); } else { return ( <span> <b> {formatted.minutes}:{formatted.seconds} </b> </span> ); } }} />
Im using Nextjs for development any help? thanks