You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For now you can restart the timer by updating the key.
Here's the sample code below:
importReact,{useState}from"react";importReactTimerfrom"@xendora/react-timer";import"./styles.css";exportdefaultfunctionApp(){const[isRestarted,setIsRestarted]=useState(false);return(<divclassName="App"><ReactTimerstart={0}key={isRestarted}end={value=>value===30}onEnd={value=>console.log("ENDED WITH VALUE",value)}onTick={value=>value+1}>{time=><div>{time}</div>}</ReactTimer><buttononClick={()=>{setIsRestarted(!isRestarted);}}>
Restart
</button></div>);}
@Bryze Let's evaluate if the need restart functionality as a prop. @shafarizkyf Any suggestions regarding api for restarting the timer are most welcome.
Activity
crup commentedon Feb 28, 2020
For now you can restart the timer by updating the key.
Here's the sample code below:
https://codesandbox.io/s/autumn-feather-fhxyb
@Bryze Let's evaluate if the need restart functionality as a prop.
@shafarizkyf Any suggestions regarding api for restarting the timer are most welcome.