Try to look here: https://reactjs.org/docs/faq-state.html
this.setState({time: this.totalSeconds})
will not work, because you want set your new state with value based on previous state. Then you have to:
this.setState(state => return {...state, time: state.time + 1})
Important is also ...state
spread, if you want to preserve all other state properties (keys).
Try to also look at functional React components. Is much more easier, you can define multiple state variables, that do not inherit one another.
e.g.
const [time, setTime] = useState(0)
And updating the time state is as easy as: setTime(t => t+1)
Do not use time as key in component, as it is changing - you are confusing the React engine. It is still the same component, so to have correct updates, preserve the key.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…