Hi can someone take a look at my code I would really appreciate it. I got everything working except test #8.
time-left is not formatted correctly: expected '25' to equal '60'
Hi can someone take a look at my code I would really appreciate it. I got everything working except test #8.
time-left is not formatted correctly: expected '25' to equal '60'
I had this issue too and I’ve just figured it out. The value I had in the “time-left” element wasn’t updating when the session and break values were being incremented or decremented.
I changed the function to update my ‘time’ state as well as the ‘sessionValue’ and ‘breakValue’ states.
This is the function
handleSetTimers = (inc, type) => {
if (this.state[type] === 60 && inc) return
if (this.state[type] === 1 && !inc) return
let newValue = this.state[type] + (inc ? 1 : -1);
if (type === "sessionValue"){
this.setState({
sessionValue: newValue,
time: newValue * 60
})
} else {
this.setState({
breakValue: newValue
})
}
}
This is the whole project: https://codepen.io/sophie-chapman/pen/ZEGvyYV