I'm trying to set the value in the state after 5 secs. But after 5 secs it showing the error at this.setState({text:false})
line.
Code snippet
constructor(props){
super(props)
this.state={
text:true,
}
}
loadtext(){
setTimeout(() => {
this.setState({text:false});
},5000)
Error:
TypeError: this.setState is not a function
How to solve this?