I\'m still fairly new at React, but I\'ve been grinding along slowly and I\'ve encountered something I\'m stuck on.
I am trying to build a \"timer\" component in Re
Updating state every second in the react class. Note the my index.js passes a function that return current time.
import React from "react";
class App extends React.Component {
constructor(props){
super(props)
this.state = {
time: this.props.time,
}
}
updateMe() {
setInterval(()=>{this.setState({time:this.state.time})},1000)
}
render(){
return (
{this.state.time()}
);
}
}
export default App;