Created
June 3, 2016 18:04
-
-
Save danott/0797f11737a5379d6d1c591044aaaf7c to your computer and use it in GitHub Desktop.
Prevent those double clicks in React
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
React.creatClass({ | |
render() { | |
return ( | |
<form onSubmit={handleSubmit}> | |
<input | |
type="submit" | |
value={this.state.loading ? "Doing it..." : "Do it!"} | |
disabled={this.state.loading} | |
/> | |
</form> | |
) | |
}, | |
handleSubmit() { | |
this.setState({ loading: true }) | |
} | |
}) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment