I am adding a timer in my react app. Currently it keeps counting seconds even after 60 seconds, I want it to reset seconds to 0 and minutes ++ obviously.
Here is my code, any tips for how I can achieve this?
componentDidMount() {
this.myInterval = setInterval(() => {
this.setState(({ seconds, minutes }) => ({
seconds: seconds + 1,
minutes: Math.floor(seconds / 60)
}))
}, 1000)
}