Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- handleTimer(evt){
- const id=evt.target.id;
- clearInterval(this.Interval)
- this.Interval=setInterval(() => {
- let timer=this.state.timer;
- if(timer > 0){
- this.setState({
- timer: this.state.timer - 1
- })
- }else if(id==="reset"){
- clearInterval(this.Interval);
- this.setState((state) => ({
- session: 25, timer:1500, break:5, isRunning:false}))
- }
- else{
- clearInterval(this.Interval)}
- },1000)}
Add Comment
Please, Sign In to add comment