Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

setstate to false after 10 sec react native

saveAndContinue: function(e) {
    e.preventDefault()

    if(this.state.submitted==false) {
        email = this.refs.email.getDOMNode().value
        this.setState({email: email})
        this.setState({submitted: !this.state.submitted});
        setTimeout(function(){
             this.setState({submitted:false});
        }.bind(this),10000);  // wait 5 seconds, then reset to false
   }
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #setstate #false #sec #react #native
ADD COMMENT
Topic
Name
9+4 =