setstate to false after 10 sec react native

Solutions on MaxInterview for setstate to false after 10 sec react native by the best coders in the world

showing results for - "setstate to false after 10 sec react native"
Angela
15 Jan 2018
1saveAndContinue: function(e) {
2    e.preventDefault()
3
4    if(this.state.submitted==false) {
5        email = this.refs.email.getDOMNode().value
6        this.setState({email: email})
7        this.setState({submitted: !this.state.submitted});
8        setTimeout(function(){
9             this.setState({submitted:false});
10        }.bind(this),10000);  // wait 5 seconds, then reset to false
11   }
12}
13