📅  最后修改于: 2022-03-11 15:04:29.193000             🧑  作者: Mango
class Controls extends React.Component{
state={
myInterval : null,
time: 25*60*1000
}
countDown = () => {
this.setState({
time : this.state.time-1000,
})
}
startTimer = () => {
this.setState({myInterval : setInterval(this.countDown,1000)})
}
stopTimer = () => {
clearInterval(this.state.myInterval)
}
render(){
return(
{this.state.time}
)
}
}
class App extends React.Component{
render(){
return
}
}
ReactDOM.render(
,
document.getElementById("react")
);