Skip to content

Instantly share code, notes, and snippets.

@danott
Created June 3, 2016 18:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danott/0797f11737a5379d6d1c591044aaaf7c to your computer and use it in GitHub Desktop.
Save danott/0797f11737a5379d6d1c591044aaaf7c to your computer and use it in GitHub Desktop.
Prevent those double clicks in React
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